#98 project deadlines edited

pull/201/head
Васин Антон 5 years ago
parent 3b0a2dd964
commit c25392337a

@ -31,8 +31,6 @@ public class ProjectDto {
private List<Integer> removedDeadlineIds = new ArrayList<>(); private List<Integer> removedDeadlineIds = new ArrayList<>();
private Set<Integer> executorIds; private Set<Integer> executorIds;
private List<UserDto> executors; private List<UserDto> executors;
private boolean hasAge;
private boolean hasDegree;
private final static int MAX_EXECUTORS_LENGTH = 40; private final static int MAX_EXECUTORS_LENGTH = 40;
@ -52,9 +50,7 @@ public class ProjectDto {
@JsonProperty("repository") String repository, @JsonProperty("repository") String repository,
@JsonProperty("deadlines") List<Deadline> deadlines, @JsonProperty("deadlines") List<Deadline> deadlines,
@JsonProperty("executorIds") Set<Integer> executorIds, @JsonProperty("executorIds") Set<Integer> executorIds,
@JsonProperty("executors") List<UserDto> executors, @JsonProperty("executors") List<UserDto> executors) {
@JsonProperty("hasAge") boolean hasAge,
@JsonProperty("hasDegree") boolean hasDegree) {
this.id = id; this.id = id;
this.title = title; this.title = title;
this.status = status; this.status = status;
@ -65,8 +61,6 @@ public class ProjectDto {
this.applicationFileName = null; this.applicationFileName = null;
this.executorIds = executorIds; this.executorIds = executorIds;
this.executors = executors; this.executors = executors;
this.hasAge = hasAge;
this.hasDegree = hasDegree;
} }
@ -172,22 +166,6 @@ public class ProjectDto {
this.executors = executors; this.executors = executors;
} }
public boolean isHasAge() {
return hasAge;
}
public void setHasAge(boolean hasAge) {
this.hasAge = hasAge;
}
public boolean isHasDegree() {
return hasDegree;
}
public void setHasDegree(boolean hasDegree) {
this.hasDegree = hasDegree;
}
public String getExecutorsString() { public String getExecutorsString() {
return StringUtils.abbreviate(executors return StringUtils.abbreviate(executors
.stream() .stream()

@ -110,8 +110,8 @@ public class ProjectService {
} }
public void removeDeadline(ProjectDto projectDto, Integer deadlineId) { public void removeDeadline(ProjectDto projectDto, Integer deadlineId) {
if (projectDto.getDeadlines().get(deadlineId).getId() != null) { if (deadlineId != null) {
projectDto.getRemovedDeadlineIds().add(projectDto.getDeadlines().get(deadlineId).getId()); projectDto.getRemovedDeadlineIds().add(deadlineId);
} }
projectDto.getDeadlines().remove((int) deadlineId); projectDto.getDeadlines().remove((int) deadlineId);
} }
@ -121,8 +121,8 @@ public class ProjectService {
} }
public List<User> getProjectExecutors(ProjectDto projectDto) { public List<User> getProjectExecutors(ProjectDto projectDto) {
List<User> filteredUsers = userService.filterByAgeAndDegree(projectDto.isHasAge(), projectDto.isHasDegree()); List<User> users = userService.findAll();
return filteredUsers; return users;
} }
} }

@ -2,15 +2,15 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet author="anton" id="20190528_000000-1"> <changeSet author="anton" id="20190528_000000-3">
<createTable tableName="deadline_executors"> <createTable tableName="deadline_executors">
<column name="deadline_id" type="integer"/> <column name="deadline_id" type="integer"/>
<column name="executors" type="integer"/> <column name="executors_id" type="integer"/>
</createTable> </createTable>
<addForeignKeyConstraint baseTableName="deadline_executors" baseColumnNames="deadline_id" <addForeignKeyConstraint baseTableName="deadline_executors" baseColumnNames="deadline_id"
constraintName="fk_deadline_deadline_executors" referencedTableName="deadline" constraintName="fk_deadline_deadline_executors" referencedTableName="deadline"
referencedColumnNames="id"/> referencedColumnNames="id"/>
<addForeignKeyConstraint baseTableName="deadline_executors" baseColumnNames="executors" <addForeignKeyConstraint baseTableName="deadline_executors" baseColumnNames="executors_id"
constraintName="fk_user_deadline_executors" referencedTableName="users" constraintName="fk_user_deadline_executors" referencedTableName="users"
referencedColumnNames="id"/> referencedColumnNames="id"/>
</changeSet> </changeSet>

@ -48,5 +48,5 @@
<include file="db/changelog-20190520_000000-schema.xml"/> <include file="db/changelog-20190520_000000-schema.xml"/>
<include file="db/changelog-20190523_000000-schema.xml"/> <include file="db/changelog-20190523_000000-schema.xml"/>
<include file="db/changelog-20190528_000000-schema.xml"/> <include file="db/changelog-20190528_000000-schema.xml"/>
<include file="db/changelog-20190528_000001-schema.xml"/> <include file="db/changelog-20190528_000002-schema.xml"/>
</databaseChangeLog> </databaseChangeLog>

@ -92,11 +92,11 @@
</div> </div>
<div class="col-12" style="margin-bottom: 15px;"></div> <div class="col-12" style="margin-bottom: 15px;"></div>
<div class="col-10 div-deadline-executor"> <div class="col-10 div-deadline-executor">
<select class="selectpicker form-control" data-live-search="true" <select class="selectpicker form-control" multiple="true" data-live-search="true"
title="-- Выберите исполнителя --" id="executors" title="-- Выберите исполнителя --" id="executors"
th:field="*{deadlines[__${rowStat.index}__].executor}" data-size="5"> th:field="*{deadlines[__${rowStat.index}__].executors}" data-size="5">
<option th:each="executor : ${allExecutors}" th:value="${executor.id}" <option th:each="executors : ${allExecutors}" th:value="${executors.id}"
th:text="${executor.lastName}"> Участник th:text="${executors.lastName}"> Участник
</option> </option>
</select> </select>
</div> </div>

Loading…
Cancel
Save