#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") @ModelAttribute("allPapers")
public List<Paper> getAllPapers() { public List<Paper> getAllPapers() {
return grantService.getAllPapers(); return grantService.getAllUncompletedPapers();
} }
private void filterEmptyDeadlines(GrantDto grantDto) { private void filterEmptyDeadlines(GrantDto grantDto) {

View File

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

View File

@ -18,4 +18,6 @@ public interface PaperRepository extends JpaRepository<Paper, Integer> {
List<Paper> findAllByIdIn(List<Integer> paperIds); List<Paper> findAllByIdIn(List<Integer> paperIds);
List<Paper> findByTypeAndStatus(Paper.PaperType type, Paper.PaperStatus status); 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 { } else {
return sortPapers(paperRepository.findAll()); return sortPapers(paperRepository.findAll());
} }
}
public List<Paper> findAllNotCompleted() {
return paperRepository.findByStatusNot(COMPLETED);
} }
public List<Paper> findAllSelect(List<Integer> paperIds) { public List<Paper> findAllSelect(List<Integer> paperIds) {