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()))
|
.filter(d -> d.getDate().after(new Date()))
|
||||||
.findFirst();
|
.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() {
|
public void closeFailedPapers() {
|
||||||
List<Paper> papers = paperRepository.findAll()
|
List<Paper> papers = paperRepository.findAll()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(paper -> paper.getNextDeadline().isPresent()
|
.filter(paper -> paper.lastDeadlineFailed()
|
||||||
&& (paper.getStatus() == ON_PREPARATION
|
&& (paper.getStatus() == ON_PREPARATION
|
||||||
|| paper.getStatus() == DRAFT
|
|| paper.getStatus() == DRAFT
|
||||||
|| paper.getStatus() == ATTENTION)
|
|| paper.getStatus() == ATTENTION))
|
||||||
&& paper.getNextDeadline().get().getDate().before(new Date()))
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
papers.forEach(paper -> {
|
papers.forEach(paper -> {
|
||||||
Paper.PaperStatus oldStatus = paper.getStatus();
|
Paper.PaperStatus oldStatus = paper.getStatus();
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Статья "<span th:text="${paper.title}">Title</span>" провалена.
|
Статья "<span th:text="${paper.title}">Title</span>" провалена.
|
||||||
Предыдущий статус - "<span th:text="${oldStatus.name}">oldStatus</span>".
|
Предыдущий статус - "<span th:text="${oldStatus.statusName}">oldStatus</span>".
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Regards,
|
Regards,
|
||||||
|
Loading…
Reference in New Issue
Block a user