Skip to content

Commit 84a1207

Browse files
committed
MOBILE-3671 assign: Remove ASSIGN_ATTEMPT_REOPEN_METHOD_NONE usage
Deprecated on MDL-80741
1 parent 40ee496 commit 84a1207

File tree

7 files changed

+15
-8
lines changed

7 files changed

+15
-8
lines changed

scripts/langindex.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@
362362
"addon.mod_assign.attempthistory": "assign",
363363
"addon.mod_assign.attemptnumber": "assign",
364364
"addon.mod_assign.attemptreopenmethod": "assign",
365+
"addon.mod_assign.attemptreopenmethod_automatic": "assign",
365366
"addon.mod_assign.attemptreopenmethod_manual": "assign",
366367
"addon.mod_assign.attemptreopenmethod_untilpass": "assign",
367368
"addon.mod_assign.attemptsettings": "assign",

src/addons/mod/assign/components/edit-feedback-modal/edit-feedback-modal.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ <h1>{{'addon.mod_assign.grade' | translate}}</h1>
8080
</ion-item>
8181

8282
<!-- Attempt status. -->
83-
@if (assign.attemptreopenmethod !== attemptReopenMethodNone) {
83+
@if (assign.maxattempts !== 1) {
8484
<ion-item class="ion-text-wrap">
8585
<ion-label>
8686
<p class="item-heading">{{ 'addon.mod_assign.attemptsettings' | translate }}</p>

src/addons/mod/assign/components/edit-feedback-modal/edit-feedback-modal.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export class AddonModAssignEditFeedbackModalComponent implements OnDestroy, OnIn
8080
gradeInfo?: AddonModAssignGradeInfo; // Grade data for the assignment, retrieved from the server.
8181
allowAddAttempt = false; // Allow adding a new attempt when grading.
8282

83-
attemptReopenMethodNone = AddonModAssignAttemptReopenMethodValues.NONE;
8483
unlimitedAttempts = ADDON_MOD_ASSIGN_UNLIMITED_ATTEMPTS;
8584
currentAttemptNumber = 0; // The current attempt number.
8685
maxAttemptsText = Translate.instant('addon.mod_assign.unlimitedattempts'); // The text for maximum attempts.
@@ -150,7 +149,7 @@ export class AddonModAssignEditFeedbackModalComponent implements OnDestroy, OnIn
150149
await this.treatGradeInfo(assign);
151150

152151
const isManual = assign.attemptreopenmethod == AddonModAssignAttemptReopenMethodValues.MANUAL;
153-
const isUnlimited = assign.maxattempts == ADDON_MOD_ASSIGN_UNLIMITED_ATTEMPTS;
152+
const isUnlimited = assign.maxattempts === ADDON_MOD_ASSIGN_UNLIMITED_ATTEMPTS;
154153
const isLessThanMaxAttempts = !!this.userSubmission && (this.userSubmission.attemptnumber < (assign.maxattempts - 1));
155154

156155
this.allowAddAttempt = isManual && (!this.userSubmission || isUnlimited || isLessThanMaxAttempts);

src/addons/mod/assign/components/submission/addon-mod-assign-submission.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@
3434
<ion-item class="divider">
3535
<ion-label>
3636
<h2 class="big">
37-
@if (currentAttemptNumber) {
38-
{{ 'addon.mod_assign.attempt' | translate : { '$a' : currentAttemptNumber } }}
37+
@if (assign.maxattempts !== 1 && currentAttemptNumber) {
38+
@if (assign.maxattempts === unlimitedAttempts) {
39+
{{ 'addon.mod_assign.attempt' | translate : { '$a' : currentAttemptNumber } }}
40+
} @else {
41+
{{ 'addon.mod_assign.attempt' | translate : { '$a' : 'addon.mod_assign.outof' | translate :
42+
{'$a': {'current': currentAttemptNumber, 'total': assign.maxattempts} } } }}
43+
}
3944
} @else {
4045
{{'addon.mod_assign.submission' | translate}}
4146
}

src/addons/mod/assign/components/submission/submission.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import {
5050
ADDON_MOD_ASSIGN_PAGE_NAME,
5151
ADDON_MOD_ASSIGN_SUBMISSION_REMOVED_EVENT,
5252
ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT,
53+
ADDON_MOD_ASSIGN_UNLIMITED_ATTEMPTS,
5354
AddonModAssignAttemptReopenMethodValues,
5455
AddonModAssignGradingStates,
5556
AddonModAssignSubmissionStatusValues,
@@ -133,7 +134,7 @@ export class AddonModAssignSubmissionComponent implements OnInit {
133134
// Some constants.
134135
statusNew = AddonModAssignSubmissionStatusValues.NEW;
135136
statusReopened = AddonModAssignSubmissionStatusValues.REOPENED;
136-
attemptReopenMethodNone = AddonModAssignAttemptReopenMethodValues.NONE;
137+
unlimitedAttempts = ADDON_MOD_ASSIGN_UNLIMITED_ATTEMPTS;
137138

138139
previousAttempts: AddonModAssignSubmissionPreviousAttemptFormatted[] = []; // List of previous attempts.
139140

@@ -853,7 +854,7 @@ export class AddonModAssignSubmissionComponent implements OnInit {
853854

854855
this.userSubmission = AddonModAssign.getSubmissionObjectFromAttempt(this.assign, lastAttempt);
855856

856-
if (this.assign.attemptreopenmethod !== this.attemptReopenMethodNone && this.userSubmission) {
857+
if (this.assign.maxattempts !== 1 && this.userSubmission) {
857858
this.currentAttemptNumber = this.userSubmission.attemptnumber + 1;
858859
}
859860

src/addons/mod/assign/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ export const enum AddonModAssignGradingStates {
7272
* Constants on LMS starting with ASSIGN_ATTEMPT_REOPEN_METHOD_
7373
*/
7474
export const enum AddonModAssignAttemptReopenMethodValues {
75-
NONE = 'none',
7675
MANUAL = 'manual',
76+
AUTOMATIC = 'automatic',
7777
UNTILPASS = 'untilpass',
7878
}
7979

src/addons/mod/assign/lang.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"attemptheading": "Attempt {{$a.attemptnumber}}: {{$a.submissionsummary}}",
1515
"attempthistory": "Previous attempts",
1616
"attemptnumber": "Attempt number",
17+
"attemptreopenmethod_automatic": "Automatically",
1718
"attemptreopenmethod_manual": "Manually",
1819
"attemptreopenmethod_untilpass": "Automatically until pass",
1920
"attemptreopenmethod": "Grant attempts",

0 commit comments

Comments
 (0)