This commit is contained in:
Andreas Svanberg 2025-01-14 11:16:38 +01:00
parent 8ce045b33c
commit 3c83bdd067
5 changed files with 51 additions and 3 deletions

@ -669,13 +669,15 @@ public class CoreConfig {
OppositionReportRepo oppositionReportRepository, OppositionReportRepo oppositionReportRepository,
GradingReportTemplateRepo gradingReportTemplateRepository, GradingReportTemplateRepo gradingReportTemplateRepository,
FileService fileService, FileService fileService,
FinalSeminarOppositionRepo finalSeminarOppositionRepository FinalSeminarOppositionRepo finalSeminarOppositionRepository,
Clock clock
) { ) {
return new OppositionReportServiceImpl( return new OppositionReportServiceImpl(
oppositionReportRepository, oppositionReportRepository,
gradingReportTemplateRepository, gradingReportTemplateRepository,
fileService, fileService,
finalSeminarOppositionRepository finalSeminarOppositionRepository,
clock
); );
} }

@ -8,6 +8,7 @@ import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne; import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToOne; import jakarta.persistence.OneToOne;
import jakarta.persistence.Table; import jakarta.persistence.Table;
import java.time.Instant;
import java.util.Objects; import java.util.Objects;
import se.su.dsv.scipro.file.FileReference; import se.su.dsv.scipro.file.FileReference;
import se.su.dsv.scipro.project.Project; import se.su.dsv.scipro.project.Project;
@ -31,6 +32,14 @@ public class FinalSeminarOpposition extends FinalSeminarParticipation {
@Column(name = "feedback", length = FEEDBACK_LENGTH) @Column(name = "feedback", length = FEEDBACK_LENGTH)
private String feedback; private String feedback;
@Basic
@Column(name = "improvements_requested_at")
private Instant improvementsRequestedAt;
@Basic
@Column(name = "supervisor_improvements_comment")
private String supervisorCommentForImprovements;
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
// JPA-mappings of foreign keys in this table (final_seminar_opposition) referencing // JPA-mappings of foreign keys in this table (final_seminar_opposition) referencing
// other tables. // other tables.
@ -92,6 +101,22 @@ public class FinalSeminarOpposition extends FinalSeminarParticipation {
this.oppositionReport = oppositionReport; this.oppositionReport = oppositionReport;
} }
public Instant getImprovementsRequestedAt() {
return improvementsRequestedAt;
}
public void setImprovementsRequestedAt(Instant improvementsRequestedAt) {
this.improvementsRequestedAt = improvementsRequestedAt;
}
public String getSupervisorCommentForImprovements() {
return supervisorCommentForImprovements;
}
public void setSupervisorCommentForImprovements(String supervisorCommentsForImprovements) {
this.supervisorCommentForImprovements = supervisorCommentsForImprovements;
}
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
// Methods Common To All Objects // Methods Common To All Objects
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------

@ -7,4 +7,6 @@ public interface OppositionReportService {
void save(OppositionReport oppositionReport); void save(OppositionReport oppositionReport);
void deleteOppositionReport(FinalSeminarOpposition finalSeminarOpposition); void deleteOppositionReport(FinalSeminarOpposition finalSeminarOpposition);
void deleteOpponentReport(FinalSeminarOpposition modelObject); void deleteOpponentReport(FinalSeminarOpposition modelObject);
void requestCompletion(FinalSeminarOpposition opposition, String supervisorComment);
} }

@ -3,6 +3,7 @@ package se.su.dsv.scipro.report;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import jakarta.inject.Named; import jakarta.inject.Named;
import jakarta.transaction.Transactional; import jakarta.transaction.Transactional;
import java.time.Clock;
import se.su.dsv.scipro.file.FileReference; import se.su.dsv.scipro.file.FileReference;
import se.su.dsv.scipro.file.FileService; import se.su.dsv.scipro.file.FileService;
import se.su.dsv.scipro.finalseminar.FinalSeminarOpposition; import se.su.dsv.scipro.finalseminar.FinalSeminarOpposition;
@ -15,18 +16,21 @@ public class OppositionReportServiceImpl implements OppositionReportService {
private GradingReportTemplateRepo gradingReportTemplateRepo; private GradingReportTemplateRepo gradingReportTemplateRepo;
private FileService fileService; private FileService fileService;
private FinalSeminarOppositionRepo finalSeminarOppositionRepo; private FinalSeminarOppositionRepo finalSeminarOppositionRepo;
private final Clock clock;
@Inject @Inject
public OppositionReportServiceImpl( public OppositionReportServiceImpl(
OppositionReportRepo oppositionReportRepo, OppositionReportRepo oppositionReportRepo,
GradingReportTemplateRepo gradingReportTemplateRepo, GradingReportTemplateRepo gradingReportTemplateRepo,
FileService fileService, FileService fileService,
FinalSeminarOppositionRepo finalSeminarOppositionRepo FinalSeminarOppositionRepo finalSeminarOppositionRepo,
Clock clock
) { ) {
this.oppositionReportRepo = oppositionReportRepo; this.oppositionReportRepo = oppositionReportRepo;
this.gradingReportTemplateRepo = gradingReportTemplateRepo; this.gradingReportTemplateRepo = gradingReportTemplateRepo;
this.fileService = fileService; this.fileService = fileService;
this.finalSeminarOppositionRepo = finalSeminarOppositionRepo; this.finalSeminarOppositionRepo = finalSeminarOppositionRepo;
this.clock = clock;
} }
@Override @Override
@ -74,4 +78,16 @@ public class OppositionReportServiceImpl implements OppositionReportService {
finalSeminarOppositionRepo.save(finalSeminarOpposition); finalSeminarOppositionRepo.save(finalSeminarOpposition);
} }
} }
@Override
@Transactional
public void requestCompletion(FinalSeminarOpposition opposition, String supervisorComment) {
OppositionReport oppositionReport = opposition.getOppositionReport();
if (oppositionReport == null) {
return;
}
oppositionReport.setSubmitted(false);
opposition.setImprovementsRequestedAt(clock.instant());
opposition.setSupervisorCommentForImprovements(supervisorComment);
}
} }

@ -0,0 +1,3 @@
ALTER TABLE `final_seminar_opposition`
ADD COLUMN `improvements_requested_at` DATETIME NULL,
ADD COLUMN `supervisor_improvements_comment` TEXT NULL;