3321 PO Set assigned reviewer and deadline correctly if the reviewer is assigned before a review is requested.

This commit is contained in:
Andreas Svanberg 2024-02-05 14:25:38 +01:00
parent 8385c1292b
commit 7720a7e8a2

@ -94,6 +94,17 @@ public class ReviewerAssignedDeadline {
});
}
@Subscribe
public void roughDraftRequestedWithExistingReviewer(RoughDraftApprovalRequestedEvent event) {
if (event.getProject().getReviewer() != null) {
Date deadline = getDeadline(reviewerDeadlineSettingsService.getInstance().getRoughDraftApproval());
Decision currentDecision = event.getRoughDraftApproval().getCurrentDecision();
currentDecision.setDeadline(deadline);
currentDecision.setAssignedReviewer(event.getProject().getReviewer());
currentDecision.setReviewerAssignedAt(LocalDate.now(clock));
}
}
protected Date getDeadline(int days) {
return daysService.workDaysAfter(new Date(), days);
}