#42 fix thymeleaf expressions
This commit is contained in:
parent
1756f29505
commit
8b2a559d37
@ -29,7 +29,7 @@ public class GrantDto {
|
|||||||
private Set<Integer> authorIds;
|
private Set<Integer> authorIds;
|
||||||
private Set<UserDto> authors;
|
private Set<UserDto> authors;
|
||||||
private Integer leaderId;
|
private Integer leaderId;
|
||||||
private boolean leader;
|
private boolean wasLeader;
|
||||||
private boolean birthDate;
|
private boolean birthDate;
|
||||||
private boolean degree;
|
private boolean degree;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ public class GrantDto {
|
|||||||
@JsonProperty("authorIds") Set<Integer> authorIds,
|
@JsonProperty("authorIds") Set<Integer> authorIds,
|
||||||
@JsonProperty("authors") Set<UserDto> authors,
|
@JsonProperty("authors") Set<UserDto> authors,
|
||||||
@JsonProperty("leader") Integer leaderId,
|
@JsonProperty("leader") Integer leaderId,
|
||||||
@JsonProperty("leader") boolean leader,
|
@JsonProperty("wasLeader") boolean wasLeader,
|
||||||
@JsonProperty("birthDate") boolean birthDate,
|
@JsonProperty("birthDate") boolean birthDate,
|
||||||
@JsonProperty("degree") boolean degree) {
|
@JsonProperty("degree") boolean degree) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -59,7 +59,7 @@ public class GrantDto {
|
|||||||
this.project = project;
|
this.project = project;
|
||||||
this.authors = authors;
|
this.authors = authors;
|
||||||
this.leaderId = leaderId;
|
this.leaderId = leaderId;
|
||||||
this.leader = leader;
|
this.wasLeader = wasLeader;
|
||||||
this.birthDate = birthDate;
|
this.birthDate = birthDate;
|
||||||
this.degree = degree;
|
this.degree = degree;
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ public class GrantDto {
|
|||||||
this.authorIds = convert(grant.getAuthors(), user -> user.getId());
|
this.authorIds = convert(grant.getAuthors(), user -> user.getId());
|
||||||
this.authors = convert(grant.getAuthors(), UserDto::new);
|
this.authors = convert(grant.getAuthors(), UserDto::new);
|
||||||
this.leaderId = grant.getLeader().getId();
|
this.leaderId = grant.getLeader().getId();
|
||||||
this.leader = false;
|
this.wasLeader = false;
|
||||||
this.birthDate = false;
|
this.birthDate = false;
|
||||||
this.degree = false;
|
this.degree = false;
|
||||||
}
|
}
|
||||||
@ -167,12 +167,12 @@ public class GrantDto {
|
|||||||
this.leaderId = leaderId;
|
this.leaderId = leaderId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLeader() {
|
public boolean isWasLeader() {
|
||||||
return leader;
|
return wasLeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLeader(boolean leader) {
|
public void setWasLeader(boolean wasLeader) {
|
||||||
this.leader = leader;
|
this.wasLeader = wasLeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBirthDate() {
|
public boolean isBirthDate() {
|
||||||
|
@ -141,7 +141,7 @@ public class GrantService {
|
|||||||
|
|
||||||
public List<User> getGrantAuthors(GrantDto grantDto) {
|
public List<User> getGrantAuthors(GrantDto grantDto) {
|
||||||
List<User> filteredUsers = userService.filterByAgeAndDegree(grantDto.isBirthDate(), grantDto.isDegree());
|
List<User> filteredUsers = userService.filterByAgeAndDegree(grantDto.isBirthDate(), grantDto.isDegree());
|
||||||
if (grantDto.isLeader()) {
|
if (grantDto.isWasLeader()) {
|
||||||
filteredUsers = filteredUsers
|
filteredUsers = filteredUsers
|
||||||
.stream()
|
.stream()
|
||||||
.filter(getCompletedGrantLeaders()::contains)
|
.filter(getCompletedGrantLeaders()::contains)
|
||||||
|
@ -29,7 +29,7 @@ public interface UserRepository extends JpaRepository<User, Integer> {
|
|||||||
User findOneWithRolesByLogin(String login);
|
User findOneWithRolesByLogin(String login);
|
||||||
|
|
||||||
@Query("SELECT u FROM User u " +
|
@Query("SELECT u FROM User u " +
|
||||||
"WHERE (YEAR(u.birthDate) - YEAR(CURRENT_DATE) < 35 OR :hasAge = FALSE) " +
|
"WHERE (YEAR(CURRENT_DATE) - YEAR(u.birthDate) < 35 OR :hasAge = FALSE) " +
|
||||||
"AND (u.degree = 'CANDIDATE' OR :hasDegree = FALSE)" +
|
"AND (u.degree = 'CANDIDATE' OR :hasDegree = FALSE)" +
|
||||||
"ORDER BY u.lastName")
|
"ORDER BY u.lastName")
|
||||||
List<User> filterByAgeAndDegree(@Param("hasAge") boolean hasAge,
|
List<User> filterByAgeAndDegree(@Param("hasAge") boolean hasAge,
|
||||||
|
@ -85,16 +85,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6 col-sm-12">
|
<div class="col-md-6 col-sm-12">
|
||||||
<label data-toggle="collapse" href="#collapse-filter"
|
<label data-toggle="collapse"
|
||||||
aria-expanded="false" aria-controls="collapse-filter">Фильтр рабочей
|
href="#collapse-filter"
|
||||||
группы</label>
|
aria-expanded="false"
|
||||||
<div class="form-check collapse" id="collapse-filter">
|
aria-controls="collapse-filter">Фильтр рабочей группы
|
||||||
|
</label>
|
||||||
|
<div th:class="${grantDto.wasLeader || grantDto.birthDate || grantDto.degree} ? 'form-check' : 'form-check collapse'" id="collapse-filter">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input class="form-check-input" type="checkbox" id="f1"
|
<input class="form-check-input" type="checkbox" id="f1"
|
||||||
th:field="*{leader}" th:onclick="|$('#filter').click();|"/>
|
th:field="*{wasLeader}" th:onclick="|$('#filter').click();|"/>
|
||||||
<label class="form-check-label" for="f1">Был руководителем проекта</label>
|
<label class="form-check-label" for="f1">Был руководителем проекта</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
Loading…
Reference in New Issue
Block a user