Skip to content

Commit

Permalink
SAK-50718 Samigo due date and late submission deadline in Date Manager (
Browse files Browse the repository at this point in the history
  • Loading branch information
st-manu authored Dec 3, 2024
1 parent 46abae0 commit 3e05cf8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ public void processAction(ActionEvent ae) throws AbortProcessingException {
if (assessmentSettings.getAutoSubmit()) {
boolean autoSubmitEnabled = ServerConfigurationService.getBoolean("samigo.autoSubmit.enabled", true);

// If late submissions not allowed and late submission date is null but due date is populated, set late submission date to due date
// If late submissions not allowed but due date is populated, set late submission date to due date
if (assessmentSettings.getLateHandling() != null && AssessmentAccessControlIfc.NOT_ACCEPT_LATE_SUBMISSION.toString().equals(assessmentSettings.getLateHandling()) &&
retractDate == null && dueDate != null && autoSubmitEnabled) {
dueDate != null && autoSubmitEnabled) {
assessmentSettings.setRetractDate(dueDate);
}

Expand All @@ -228,6 +228,12 @@ public void processAction(ActionEvent ae) throws AbortProcessingException {
}
}

// if auto-submit and late-submissions are disabled Set retract date to null
if ( !assessmentSettings.getAutoSubmit() && retractDate != null &&
assessmentSettings.getLateHandling() != null && AssessmentAccessControlIfc.NOT_ACCEPT_LATE_SUBMISSION.toString().equals(assessmentSettings.getLateHandling())){
assessmentSettings.setRetractDate(null);
}

if (!isFromActionSelect) {
if (assessmentSettings.getReleaseTo().equals(AssessmentAccessControl.RELEASE_TO_SELECTED_GROUPS)) {
String[] groupsAuthorized = assessmentSettings.getGroupsAuthorized(); //getGroupsAuthorized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,9 @@ public boolean checkPublishedSettings(PublishedAssessmentService assessmentServi
if (assessmentSettings.getAutoSubmit()) {
boolean autoSubmitEnabled = ServerConfigurationService.getBoolean("samigo.autoSubmit.enabled", true);

// If late submissions not allowed and late submission date is null, set late submission date to due date
// If late submissions not allowed, set late submission date to due date
if (assessmentSettings.getLateHandling() != null && AssessmentAccessControlIfc.NOT_ACCEPT_LATE_SUBMISSION.toString().equals(assessmentSettings.getLateHandling()) &&
retractDate == null && dueDate != null && autoSubmitEnabled) {
dueDate != null && autoSubmitEnabled) {
assessmentSettings.setRetractDate(dueDate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ public DateManagerValidation validateAssessments(String siteId, JSONArray assess
if (dueDate == null) {
errors.add(new DateManagerError(DateManagerConstants.JSON_DUEDATE_PARAM_NAME,rb.getString("error.due.date.not.found.accept.until"),"assessments", toolTitle, idx));
errored = true;
} else if (acceptUntil.isBefore(dueDate)) {
} else if (acceptUntil.isBefore(dueDate) && lateHandling) {
errors.add(new DateManagerError(DateManagerConstants.JSON_ACCEPTUNTIL_PARAM_NAME,rb.getString("error.accept.until.before.due.date.open.date"),"assessments", toolTitle, idx));
errored = true;
}
Expand Down Expand Up @@ -622,6 +622,10 @@ public void updateAssessments(DateManagerValidation assessmentsValidation) throw
Date lateDateTemp =
update.acceptUntilDate != null ? Date.from(update.acceptUntilDate) : null;
control.setRetractDate(lateDateTemp);
} else {
if (control.getRetractDate() != null) {
control.setRetractDate(dueDateTemp);
}
}
if (AssessmentFeedbackIfc.FEEDBACK_BY_DATE.equals(assessment.getAssessmentFeedback().getFeedbackDelivery())) {
control.setFeedbackDate(Date.from(update.feedbackStartDate));
Expand All @@ -644,6 +648,10 @@ public void updateAssessments(DateManagerValidation assessmentsValidation) throw
Date lateDateTemp =
update.acceptUntilDate != null ? Date.from(update.acceptUntilDate) : null;
control.setRetractDate(lateDateTemp);
} else {
if (control.getRetractDate() != null) {
control.setRetractDate(dueDateTemp);
}
}
if (AssessmentFeedbackIfc.FEEDBACK_BY_DATE.equals(assessment.getAssessmentFeedback().getFeedbackDelivery())) {
control.setFeedbackDate(Date.from(update.feedbackStartDate));
Expand Down

0 comments on commit 3e05cf8

Please sign in to comment.