Allow changes to the reflection to be made after it's been submitted #13

Merged
ansv7779 merged 20 commits from 3412-supervisor-edit-reflection into develop 2024-11-21 19:20:48 +01:00
7 changed files with 56 additions and 2 deletions
Showing only changes of commit ffb571fd23 - Show all commits

View File

@ -20,7 +20,7 @@ public class ProjectEvent extends NotificationEvent {
ROUGH_DRAFT_APPROVAL_APPROVED, ROUGH_DRAFT_APPROVAL_REJECTED, REVIEWER_GRADING_REPORT_SUBMITTED, ROUGH_DRAFT_APPROVAL_APPROVED, ROUGH_DRAFT_APPROVAL_REJECTED, REVIEWER_GRADING_REPORT_SUBMITTED,
ONE_YEAR_PASSED_FROM_LATEST_ANNUAL_REVIEW, SUPERVISOR_GRADING_INITIAL_ASSESSMENT_DONE, ONE_YEAR_PASSED_FROM_LATEST_ANNUAL_REVIEW, SUPERVISOR_GRADING_INITIAL_ASSESSMENT_DONE,
EXPORTED_SUCCESS, REVIEWER_GRADING_INITIAL_ASSESSMENT_DONE, FIRST_MEETING, OPPOSITION_FAILED, PARTICIPATION_APPROVED, COMPLETED, EXPORTED_SUCCESS, REVIEWER_GRADING_INITIAL_ASSESSMENT_DONE, FIRST_MEETING, OPPOSITION_FAILED, PARTICIPATION_APPROVED, COMPLETED,
PARTICIPATION_FAILED REFLECTION_IMPROVEMENTS_REQUESTED, PARTICIPATION_FAILED
} }
@ManyToOne @ManyToOne

View File

@ -85,6 +85,10 @@ PROJECT.PARTICIPATION_APPROVED.body = Your active participation on {0} has been
PROJECT.PARTICIPATION_FAILED.title = Your active participation on {1} did not meet the minimum requirements. PROJECT.PARTICIPATION_FAILED.title = Your active participation on {1} did not meet the minimum requirements.
PROJECT.PARTICIPATION_FAILED.body = Your active participation did not meet the minimum requirements set, and you will \ PROJECT.PARTICIPATION_FAILED.body = Your active participation did not meet the minimum requirements set, and you will \
have to be an active participant on a different final seminar to pass this step. have to be an active participant on a different final seminar to pass this step.
PROJECT.REFLECTION_IMPROVEMENTS_REQUESTED.title = Reflection improvements requested
PROJECT.REFLECTION_IMPROVEMENTS_REQUESTED.body = The supervisor has deemed that the reflection submitted does not meet \
the minimum requirements and has requested improvements. Please log into SciPro and submit a new reflection. \
Their comments can be seen below:\n\n{0}
FORUM.NEW_FORUM_POST.title = Forum post: {2} FORUM.NEW_FORUM_POST.title = Forum post: {2}
FORUM.NEW_FORUM_POST.body = New forum post submitted:<br /><br />{0} FORUM.NEW_FORUM_POST.body = New forum post submitted:<br /><br />{0}

View File

@ -0,0 +1,7 @@
package se.su.dsv.scipro.reflection;
import se.su.dsv.scipro.project.Project;
import se.su.dsv.scipro.system.User;
public record ReflectionImprovementsRequestedEvent(Project project, User author, String supervisorComment) {
}

View File

@ -1,5 +1,6 @@
package se.su.dsv.scipro.reflection; package se.su.dsv.scipro.reflection;
import com.google.common.eventbus.EventBus;
import com.google.inject.persist.Transactional; import com.google.inject.persist.Transactional;
import se.su.dsv.scipro.finalseminar.AuthorRepository; import se.su.dsv.scipro.finalseminar.AuthorRepository;
import se.su.dsv.scipro.finalseminar.FinalSeminarService; import se.su.dsv.scipro.finalseminar.FinalSeminarService;
@ -15,11 +16,17 @@ import java.util.Optional;
class ReflectionServiceImpl implements ReflectionService { class ReflectionServiceImpl implements ReflectionService {
private final AuthorRepository authorRepository; private final AuthorRepository authorRepository;
private final FinalSeminarService finalSeminarService; private final FinalSeminarService finalSeminarService;
private final EventBus eventBus;
@Inject @Inject
ReflectionServiceImpl(AuthorRepository authorRepository, FinalSeminarService finalSeminarService) { ReflectionServiceImpl(
AuthorRepository authorRepository,
FinalSeminarService finalSeminarService,
EventBus eventBus)
{
this.authorRepository = authorRepository; this.authorRepository = authorRepository;
this.finalSeminarService = finalSeminarService; this.finalSeminarService = finalSeminarService;
this.eventBus = eventBus;
} }
@Override @Override
@ -63,6 +70,7 @@ class ReflectionServiceImpl implements ReflectionService {
author.setReflectionStatus(ReflectionStatus.IMPROVEMENTS_NEEDED); author.setReflectionStatus(ReflectionStatus.IMPROVEMENTS_NEEDED);
author.setReflectionSupervisorComment(supervisorComment); author.setReflectionSupervisorComment(supervisorComment);
}); });
eventBus.post(new ReflectionImprovementsRequestedEvent(project, user, supervisorComment));
} }
@Override @Override

View File

@ -13,5 +13,6 @@ public class CrosscuttingModule extends AbstractModule {
bind(ReviewerAssignedNotifications.class).asEagerSingleton(); bind(ReviewerAssignedNotifications.class).asEagerSingleton();
bind(ReviewerAssignedDeadline.class).asEagerSingleton(); bind(ReviewerAssignedDeadline.class).asEagerSingleton();
bind(ForwardPhase2Feedback.class).asEagerSingleton(); bind(ForwardPhase2Feedback.class).asEagerSingleton();
bind(NotifyFailedReflection.class).asEagerSingleton();
} }
} }

View File

@ -0,0 +1,33 @@
package se.su.dsv.scipro.crosscutting;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import jakarta.inject.Inject;
import se.su.dsv.scipro.data.dataobjects.Member;
import se.su.dsv.scipro.notifications.NotificationController;
import se.su.dsv.scipro.notifications.dataobject.NotificationSource;
import se.su.dsv.scipro.notifications.dataobject.ProjectEvent;
import se.su.dsv.scipro.reflection.ReflectionImprovementsRequestedEvent;
import java.util.Set;
public class NotifyFailedReflection {
private final NotificationController notificationController;
@Inject
public NotifyFailedReflection(NotificationController notificationController, EventBus eventBus) {
this.notificationController = notificationController;
eventBus.register(this);
}
@Subscribe
public void reflectionImprovementsRequested(ReflectionImprovementsRequestedEvent event) {
NotificationSource source = new NotificationSource();
source.setMessage(event.supervisorComment());
notificationController.notifyCustomProject(
event.project(),
ProjectEvent.Event.REFLECTION_IMPROVEMENTS_REQUESTED,
source,
Set.of(new Member(event.author(), Member.Type.AUTHOR)));
}
}

View File

@ -65,6 +65,7 @@ ProjectEvent.FIRST_MEETING = First meeting created. (with date, time, place/room
ProjectEvent.OPPOSITION_FAILED = An author fails their opposition. ProjectEvent.OPPOSITION_FAILED = An author fails their opposition.
ProjectEvent.PARTICIPATION_APPROVED = An author's active participation is approved. ProjectEvent.PARTICIPATION_APPROVED = An author's active participation is approved.
ProjectEvent.PARTICIPATION_FAILED = An author fails their active participation. ProjectEvent.PARTICIPATION_FAILED = An author fails their active participation.
ProjectEvent.REFLECTION_IMPROVEMENTS_REQUESTED = Reflection improvements requested.
ProjectForumEvent.NEW_FORUM_POST = Forum thread created. ProjectForumEvent.NEW_FORUM_POST = Forum thread created.
ProjectForumEvent.NEW_FORUM_POST_COMMENT = Comment posted in forum thread. ProjectForumEvent.NEW_FORUM_POST_COMMENT = Comment posted in forum thread.