Skip to content

Commit

Permalink
SAK-45527 Check accept-until date first (sakaiproject#9276)
Browse files Browse the repository at this point in the history
Move the check for allowing a new submission (finalising a draft
submission) before the check for allowing a resubmission of a
submitted submission.
  • Loading branch information
smarquard authored May 24, 2021
1 parent 0667771 commit 6628e03
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2105,7 +2105,15 @@ public boolean canSubmit(Assignment assignment, String userId) {
AssignmentSubmission submission = getSubmission(AssignmentReferenceReckoner.reckoner().assignment(assignment).reckon().getId(), userId);

if (submission != null) {
// check for allow resubmission or not first

if (isBeforeAssignmentCloseDate && (submission.getDateSubmitted() == null || !submission.getSubmitted())) {
// before the assignment close date
// and if no date then a submission was never never submitted
// or if there is a submitted date and its a not submitted then it is considered a draft
return true;
}

// check for allow resubmission or not
// return true if resubmission is allowed and current time is before resubmission close time
// get the resubmit settings from submission object first
String allowResubmitNumString = submission.getProperties().get(AssignmentConstants.ALLOW_RESUBMIT_NUMBER);
Expand All @@ -2127,13 +2135,6 @@ public boolean canSubmit(Assignment assignment, String userId) {
log.warn("allowResubmitNumString = {}, allowResubmitCloseTime = {}", allowResubmitNumString, allowResubmitCloseTime, e);
}
}

if (isBeforeAssignmentCloseDate && (submission.getDateSubmitted() == null || !submission.getSubmitted())) {
// before the assignment close date
// and if no date then a submission was never never submitted
// or if there is a submitted date and its a not submitted then it is considered a draft
return true;
}
} else {
// there is no submission yet so only check if before assignment close date
return isBeforeAssignmentCloseDate;
Expand Down

0 comments on commit 6628e03

Please sign in to comment.