2984 PO 11) Can only remove final thesis if no students have been submitted for examination

This commit is contained in:
Andreas Svanberg 2023-10-04 14:19:38 +02:00
parent b2af1906d5
commit 239c648549
3 changed files with 16 additions and 3 deletions
core/src/main/java/se/su/dsv/scipro/finalthesis
view/src/main/java/se/su/dsv/scipro/grading

@ -25,6 +25,8 @@ public interface FinalThesisService extends GenericService<FinalThesis, Long>,
void removePlagiarismAnalysis(FinalThesis finalThesis);
boolean canReject(Project project);
class Filter implements Serializable {
private FinalThesis.Status status;

@ -110,9 +110,7 @@ public class FinalThesisServiceImpl extends AbstractServiceImpl<FinalThesis, Lon
@Override
public boolean canRemovePlagiarismAnalysis(FinalThesis finalThesis) {
return gradingReportService.getSupervisorGradingReports(finalThesis.getProject())
.stream()
.noneMatch(SupervisorGradingReport::isSubmitted);
return canReject(finalThesis.getProject());
}
@Override
@ -125,6 +123,13 @@ public class FinalThesisServiceImpl extends AbstractServiceImpl<FinalThesis, Lon
save(finalThesis);
}
@Override
public boolean canReject(Project project) {
return gradingReportService.getSupervisorGradingReports(project)
.stream()
.noneMatch(SupervisorGradingReport::isSubmitted);
}
@Override
@Transactional
public void approve(Project project, final String englishTitle, final String swedishTitle) {

@ -38,6 +38,12 @@ public class ThesisApprovedPanel extends GenericPanel<Project> {
public void onClick() {
finalThesisService.reject(getModelObject());
}
@Override
protected void onConfigure() {
super.onConfigure();
setVisibilityAllowed(finalThesisService.canReject(getModelObject()));
}
});
}