diff --git a/scripts/langindex.json b/scripts/langindex.json
index d773eddd2..5b18e0fbf 100644
--- a/scripts/langindex.json
+++ b/scripts/langindex.json
@@ -872,6 +872,7 @@
"addon.mod_page.errorwhileloadingthepage": "local_moodlemobileapp",
"addon.mod_page.modulenameplural": "page",
"addon.mod_quiz.answercolon": "qtype_numerical",
+ "addon.mod_quiz.attempt": "quiz",
"addon.mod_quiz.attemptduration": "quiz",
"addon.mod_quiz.attemptfirst": "quiz",
"addon.mod_quiz.attemptlast": "quiz",
@@ -902,7 +903,7 @@
"addon.mod_quiz.errorsaveattempt": "local_moodlemobileapp",
"addon.mod_quiz.feedback": "quiz",
"addon.mod_quiz.finishattemptdots": "quiz",
- "addon.mod_quiz.finishnotsynced": "local_moodlemobileapp",
+ "addon.mod_quiz.finishedofflinenotice": "local_moodlemobileapp",
"addon.mod_quiz.grade": "quiz",
"addon.mod_quiz.gradeaverage": "quiz",
"addon.mod_quiz.gradehighest": "quiz",
@@ -1864,6 +1865,7 @@
"core.grades.grade": "grades",
"core.grades.gradebook": "grades",
"core.grades.gradeitem": "grades",
+ "core.grades.gradelong": "grades",
"core.grades.gradepass": "grades",
"core.grades.grades": "grades",
"core.grades.lettergrade": "grades",
@@ -2560,6 +2562,7 @@
"core.strftimetime12": "langconfig",
"core.strftimetime24": "langconfig",
"core.submit": "moodle",
+ "core.submittedoffline": "local_moodlemobileapp",
"core.success": "moodle",
"core.summary": "moodle",
"core.swipenavigationtourdescription": "local_moodlemobileapp",
diff --git a/src/addons/mod/quiz/components/attempt-info/attempt-info.html b/src/addons/mod/quiz/components/attempt-info/attempt-info.html
new file mode 100644
index 000000000..a23777ddd
--- /dev/null
+++ b/src/addons/mod/quiz/components/attempt-info/attempt-info.html
@@ -0,0 +1,78 @@
+ {{ 'addon.mod_quiz.attemptstate' | translate }} {{ 'addon.mod_quiz.startedon' | translate }} {{ attempt.timestart! * 1000 | coreFormatDate }} {{ 'addon.mod_quiz.completedon' | translate }} {{ attempt.timefinish! * 1000 | coreFormatDate }} {{ 'addon.mod_quiz.attemptduration' | translate }} {{ timeTaken }} {{ 'addon.mod_quiz.overdue' | translate }} {{ overTime }} {{ gradeItemMark.name }} {{ 'addon.mod_quiz.marks' | translate }} {{ readableMark }} {{ 'addon.mod_quiz.grade' | translate }} {{ data.title }} {{ sentence }} {{ attempt.readableGrade }}
+ {{ 'core.grades.gradelong' | translate: { $a: {
+ grade: attempt.formattedGrade,
+ max: quiz.gradeFormatted,
+ } } }}
+ {{ 'addon.mod_quiz.notyetgraded' | translate }}
+
+ {{ 'addon.mod_quiz.attempt' | translate:{ $a: attempt.attempt } }}
+
+
+
{{ 'addon.mod_quiz.overallfeedback' | translate }}
diff --git a/src/addons/mod/quiz/components/index/index.scss b/src/addons/mod/quiz/components/index/index.scss
index c153eae1b..b7640a4aa 100644
--- a/src/addons/mod/quiz/components/index/index.scss
+++ b/src/addons/mod/quiz/components/index/index.scss
@@ -1,33 +1,43 @@
+@use "theme/globals" as *;
+
:host {
- .addon-mod_quiz-table {
- ion-card-content {
- padding-left: 0;
- padding-right: 0;
- }
+ .addon-mod_quiz-attempt-title-info {
+ text-align: end;
+ padding-top: 8px;
+ padding-bottom: 8px;
- .item:nth-child(even) {
- --background: var(--light);
- }
-
- .addon-mod_quiz-highlighted,
- .item.addon-mod_quiz-highlighted,
- .addon-mod_quiz-highlighted p,
- .item.addon-mod_quiz-highlighted p {
- --background: var(--primary-tint);
- color: var(--primary-shade);
+ p {
+ margin: 0px;
+ margin-top: 4px;
}
}
-}
-:host-context(html.dark) {
- .addon-mod_quiz-table {
- .addon-mod_quiz-highlighted,
- .item.addon-mod_quiz-highlighted,
- .addon-mod_quiz-highlighted p,
- .item.addon-mod_quiz-highlighted p {
- --background: var(--primary-shade);
- color: var(--primary-tint);
+ .accordion-expanded .addon-mod_quiz-attempt-title-info,
+ .accordion-expanding .addon-mod_quiz-attempt-title-info {
+ visibility: hidden;
+ }
+
+ hr {
+ background-color: var(--stroke);
+ height: 1px;
+ margin: 0px 16px;
+ }
+
+ ion-accordion:nth-child(odd) {
+ background-color: var(--core-table-odd-cell-background);
+
+ ::ng-deep ion-item {
+ --background: var(--core-table-odd-cell-background);
}
}
+
+ ion-accordion:nth-child(even) {
+ background-color: var(--core-table-even-cell-background);
+
+ ::ng-deep ion-item {
+ --background: var(--core-table-even-cell-background);
+ }
+ }
+
}
diff --git a/src/addons/mod/quiz/components/index/index.ts b/src/addons/mod/quiz/components/index/index.ts
index 77d14dacd..f0b27e252 100644
--- a/src/addons/mod/quiz/components/index/index.ts
+++ b/src/addons/mod/quiz/components/index/index.ts
@@ -13,7 +13,7 @@
// limitations under the License.
import { DownloadStatus } from '@/core/constants';
-import { safeNumber, SafeNumber } from '@/core/utils/types';
+import { isSafeNumber, safeNumber, SafeNumber } from '@/core/utils/types';
import { Component, OnDestroy, OnInit, Optional } from '@angular/core';
import { CoreCourseModuleMainActivityComponent } from '@features/course/classes/main-activity-component';
@@ -36,6 +36,7 @@ import {
AddonModQuizGetAttemptAccessInformationWSResponse,
AddonModQuizGetQuizAccessInformationWSResponse,
AddonModQuizGetUserBestGradeWSResponse,
+ AddonModQuizWSAdditionalData,
} from '../../services/quiz';
import { AddonModQuizAttempt, AddonModQuizHelper, AddonModQuizQuizData } from '../../services/quiz-helper';
import {
@@ -44,7 +45,7 @@ import {
AddonModQuizSyncProvider,
AddonModQuizSyncResult,
} from '../../services/quiz-sync';
-import { ADDON_MOD_QUIZ_ATTEMPT_FINISHED_EVENT, ADDON_MOD_QUIZ_COMPONENT, AddonModQuizGradeMethods } from '../../constants';
+import { ADDON_MOD_QUIZ_ATTEMPT_FINISHED_EVENT, ADDON_MOD_QUIZ_COMPONENT, AddonModQuizAttemptStates } from '../../constants';
import { QuestionDisplayOptionsMarks } from '@features/question/constants';
/**
@@ -78,13 +79,12 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
showStatusSpinner = true; // Whether to show a spinner due to quiz status.
gradeMethodReadable?: string; // Grade method in a readable format.
showReviewColumn = false; // Whether to show the review column.
- attempts: AddonModQuizAttempt[] = []; // List of attempts the user has made.
+ attempts: QuizAttempt[] = []; // List of attempts the user has made.
bestGrade?: AddonModQuizGetUserBestGradeWSResponse; // Best grade data.
protected fetchContentDefaultError = 'addon.mod_quiz.errorgetquiz'; // Default error to show when loading contents.
protected syncEventName = AddonModQuizSyncProvider.AUTO_SYNCED;
- // protected quizData: any; // Quiz instance. This variable will store the quiz instance until it's ready to be shown
protected autoReview?: AddonModQuizAttemptFinishedData; // Data to auto-review an attempt after finishing.
protected quizAccessInfo?: AddonModQuizGetQuizAccessInformationWSResponse; // Quiz access info.
protected attemptAccessInfo?: AddonModQuizGetAttemptAccessInformationWSResponse; // Last attempt access info.
@@ -263,7 +263,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
// Check if user can create/continue attempts.
if (this.attempts.length) {
- const last = this.attempts[this.attempts.length - 1];
+ const last = this.attempts[0];
this.moreAttempts = !AddonModQuiz.isAttemptCompleted(last.state) || !this.attemptAccessInfo.isfinished;
} else {
this.moreAttempts = !this.attemptAccessInfo.isfinished;
@@ -283,7 +283,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
this.buttonText = '';
if (quiz.hasquestions !== 0) {
- if (this.attempts.length && !AddonModQuiz.isAttemptCompleted(this.attempts[this.attempts.length - 1].state)) {
+ if (this.attempts.length && !AddonModQuiz.isAttemptCompleted(this.attempts[0].state)) {
// Last attempt is unfinished.
if (this.quizAccessInfo?.canattempt) {
this.buttonText = 'addon.mod_quiz.continueattemptquiz';
@@ -331,7 +331,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
* @returns Promise resolved when done.
*/
protected async getResultInfo(quiz: AddonModQuizQuizData): Promise {{ 'addon.mod_quiz.attemptnumber' | translate }} {{ 'addon.mod_quiz.preview' | translate }} {{ attempt.attempt }} {{ 'addon.mod_quiz.attemptstate' | translate }} {{ sentence }} {{ gradeItemMark.name }} / {{ gradeItemMark.maxgrade }} {{ gradeItemMark.grade }} {{ 'addon.mod_quiz.marks' | translate }} / {{ quiz!.sumGradesFormatted }} {{ attempt.readableMark }} {{ 'addon.mod_quiz.grade' | translate }} / {{ quiz!.gradeFormatted }} {{ attempt.readableGrade }} {{ 'addon.mod_quiz.feedback' | translate }}
- {{ 'addon.mod_quiz.noreviewattempt' | translate }} {{ 'addon.mod_quiz.startedon' | translate }} {{ attempt.timestart! * 1000 | coreFormatDate }} {{ 'addon.mod_quiz.attemptstate' | translate }} {{ readableState }} {{ 'addon.mod_quiz.completedon' | translate }} {{ attempt.timefinish! * 1000 | coreFormatDate }} {{ 'addon.mod_quiz.attemptduration' | translate }} {{ timeTaken }} {{ 'addon.mod_quiz.overdue' | translate }} {{ overTime }} {{ gradeItemMark.name }} {{ gradeItemMark.grade }} {{ 'addon.mod_quiz.marks' | translate }} {{ readableMark }} {{ 'addon.mod_quiz.grade' | translate }} {{ readableGrade }} {{ data.title }}
-
-