#109 only uncompleted for grant

This commit is contained in:
Семенова Мария 2019-05-07 20:26:49 +04:00
parent 2dff183662
commit dffd839905
4 changed files with 10 additions and 1 deletions

View File

@ -132,7 +132,7 @@ public class GrantController {
@ModelAttribute("allPapers")
public List<Paper> getAllPapers() {
return grantService.getAllPapers();
return grantService.getAllUncompletedPapers();
}
private void filterEmptyDeadlines(GrantDto grantDto) {

View File

@ -196,6 +196,10 @@ public class GrantService {
return paperService.findAll();
}
public List<Paper> getAllUncompletedPapers() {
return paperService.findAllNotCompleted();
}
public void attachPaper(GrantDto grantDto) {
if (!grantDto.getPaperIds().isEmpty()) {
grantDto.getPapers().clear();

View File

@ -18,4 +18,6 @@ public interface PaperRepository extends JpaRepository<Paper, Integer> {
List<Paper> findAllByIdIn(List<Integer> paperIds);
List<Paper> findByTypeAndStatus(Paper.PaperType type, Paper.PaperStatus status);
List<Paper> findByStatusNot(Paper.PaperStatus status);
}

View File

@ -246,7 +246,10 @@ public class PaperService {
} else {
return sortPapers(paperRepository.findAll());
}
}
public List<Paper> findAllNotCompleted() {
return paperRepository.findByStatusNot(COMPLETED);
}
public List<Paper> findAllSelect(List<Integer> paperIds) {