MOBILE-3947 assign: Do not require submission statement if empty

main
Pau Ferrer Ocaña 2023-12-05 12:02:40 +01:00
parent 1e16f68070
commit 6c28885260
2 changed files with 12 additions and 0 deletions

View File

@ -1124,9 +1124,15 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
return [];
}
// Receved submission statement should not be undefined. It would mean that the WS is not returning the value.
const submissionStatementMissing = !!this.assign.requiresubmissionstatement &&
this.assign.submissionstatement === undefined;
// If received submission statement is empty, then it's not required.
if(!this.assign.submissionstatement && this.assign.submissionstatement !== undefined) {
this.assign.requiresubmissionstatement = 0;
}
this.canSubmit = !this.isSubmittedForGrading && !this.submittedOffline && (lastAttempt.cansubmit ||
(this.hasOffline && AddonModAssign.canSubmitOffline(this.assign, submissionStatus)));

View File

@ -205,6 +205,12 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
this.introAttachments = submissionStatus.assignmentdata?.attachments?.intro ?? this.assign.introattachments;
this.allowOffline = true; // If offline isn't allowed we shouldn't have reached this point.
// If received submission statement is empty, then it's not required.
if(!this.assign.submissionstatement && this.assign.submissionstatement !== undefined) {
this.assign.requiresubmissionstatement = 0;
}
// Only show submission statement if we are editing our own submission.
if (this.assign.requiresubmissionstatement && !this.assign.submissiondrafts && this.userId == currentUserId) {
this.submissionStatement = this.assign.submissionstatement;