fix failed conditions
This commit is contained in:
parent
c17591bf10
commit
779bc3eafc
@ -169,4 +169,13 @@ public class Paper extends BaseEntity implements UserContainer {
|
||||
.filter(d -> d.getDate().after(new Date()))
|
||||
.findFirst();
|
||||
}
|
||||
|
||||
public boolean lastDeadlineFailed() {
|
||||
return !deadlines
|
||||
.stream()
|
||||
.filter(deadline -> deadline.getDate() != null)
|
||||
.filter(d -> d.getDate().after(new Date()))
|
||||
.findAny()
|
||||
.isPresent();
|
||||
}
|
||||
}
|
||||
|
@ -166,11 +166,10 @@ public class PaperService {
|
||||
public void closeFailedPapers() {
|
||||
List<Paper> papers = paperRepository.findAll()
|
||||
.stream()
|
||||
.filter(paper -> paper.getNextDeadline().isPresent()
|
||||
.filter(paper -> paper.lastDeadlineFailed()
|
||||
&& (paper.getStatus() == ON_PREPARATION
|
||||
|| paper.getStatus() == DRAFT
|
||||
|| paper.getStatus() == ATTENTION)
|
||||
&& paper.getNextDeadline().get().getDate().before(new Date()))
|
||||
|| paper.getStatus() == ATTENTION))
|
||||
.collect(Collectors.toList());
|
||||
papers.forEach(paper -> {
|
||||
Paper.PaperStatus oldStatus = paper.getStatus();
|
||||
|
@ -11,7 +11,7 @@
|
||||
</p>
|
||||
<p>
|
||||
Статья "<span th:text="${paper.title}">Title</span>" провалена.
|
||||
Предыдущий статус - "<span th:text="${oldStatus.name}">oldStatus</span>".
|
||||
Предыдущий статус - "<span th:text="${oldStatus.statusName}">oldStatus</span>".
|
||||
</p>
|
||||
<p>
|
||||
Regards,
|
||||
|
Loading…
Reference in New Issue
Block a user