diff --git a/scripts/langindex.json b/scripts/langindex.json index 523dd673afb..be537c0a24a 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -919,6 +919,7 @@ "addon.mod_quiz.stateoverdue": "quiz", "addon.mod_quiz.stateoverduedetails": "quiz", "addon.mod_quiz.status": "quiz", + "addon.mod_quiz.submission_confirmation_unanswered": "quiz", "addon.mod_quiz.submitallandfinish": "quiz", "addon.mod_quiz.summaryofattempt": "quiz", "addon.mod_quiz.summaryofattempts": "quiz", diff --git a/src/addons/mod/quiz/lang.json b/src/addons/mod/quiz/lang.json index d62d1d3c0fc..dc328c5e1de 100644 --- a/src/addons/mod/quiz/lang.json +++ b/src/addons/mod/quiz/lang.json @@ -68,6 +68,7 @@ "stateoverdue": "Overdue", "stateoverduedetails": "Must be submitted by {{$a}}", "status": "Status", + "submission_confirmation_unanswered": "Questions without a response: {{$a}}", "submitallandfinish": "Submit all and finish", "summaryofattempt": "Summary of attempt", "summaryofattempts": "Summary of your previous attempts", diff --git a/src/addons/mod/quiz/pages/player/player.ts b/src/addons/mod/quiz/pages/player/player.ts index 0ea6316c0a5..818c4440df3 100644 --- a/src/addons/mod/quiz/pages/player/player.ts +++ b/src/addons/mod/quiz/pages/player/player.ts @@ -406,7 +406,34 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { try { // Show confirm if the user clicked the finish button and the quiz is in progress. if (!timeUp && this.attempt.state == AddonModQuizProvider.ATTEMPT_IN_PROGRESS) { - await CoreDomUtils.showConfirm(Translate.instant('addon.mod_quiz.confirmclose')); + let message = Translate.instant('addon.mod_quiz.confirmclose'); + + const unansweredCount = this.summaryQuestions + .filter(question => question.state === 'todo' || question.state === 'invalid') + .length; + + if (unansweredCount > 0) { + const warning = Translate.instant( + 'addon.mod_quiz.submission_confirmation_unanswered', + { $a: unansweredCount }, + ); + + message += ` + + + + ${ warning } + + + + `; + } + + await CoreDomUtils.showConfirm( + message, + Translate.instant('addon.mod_quiz.submitallandfinish'), + Translate.instant('core.submit'), + ); } modal = await CoreDomUtils.showModalLoading('core.sending', true); diff --git a/src/addons/mod/quiz/tests/behat/basic_usage-311.feature b/src/addons/mod/quiz/tests/behat/basic_usage-311.feature index 5e39b28799d..27cf76e317c 100644 --- a/src/addons/mod/quiz/tests/behat/basic_usage-311.feature +++ b/src/addons/mod/quiz/tests/behat/basic_usage-311.feature @@ -125,7 +125,7 @@ Feature: Attempt a quiz in app Then I should find "Summary of attempt" in the app When I press "Submit all and finish" in the app - And I press "OK" near "Once you submit" in the app + And I press "Submit" near "Once you submit" in the app Then I should find "Review" in the app And I should find "Started on" in the app And I should find "State" in the app @@ -184,7 +184,7 @@ Feature: Attempt a quiz in app But I should not find "Not yet answered" in the app When I press "Submit all and finish" in the app - And I press "OK" in the app + And I press "Submit" in the app Then I should find "Review" in the app And I should find "Finished" in the app And I should find "Not yet graded" in the app @@ -203,7 +203,7 @@ Feature: Attempt a quiz in app And I press "False" in the app And I press "Submit" in the app And I press "Submit all and finish" in the app - And I press "OK" in the app + And I press "Submit" in the app Then I should find "Review" in the app When I replace "/.*/" within "page-addon-mod-quiz-review core-loading > ion-card ion-item:nth-child(1) p:nth-child(2)" with "[Started on date]" diff --git a/src/addons/mod/quiz/tests/behat/basic_usage-39.feature b/src/addons/mod/quiz/tests/behat/basic_usage-39.feature index db17d5d8034..d3392fd7c0c 100644 --- a/src/addons/mod/quiz/tests/behat/basic_usage-39.feature +++ b/src/addons/mod/quiz/tests/behat/basic_usage-39.feature @@ -113,7 +113,7 @@ Feature: Attempt a quiz in app And I should find "Incomplete answer" within "9" "ion-item" in the app When I press "Submit all and finish" in the app - And I press "OK" in the app + And I press "Submit" in the app Then I should find "Review" in the app And I should find "Finished" in the app And I should find "Not yet graded" in the app diff --git a/src/addons/mod/quiz/tests/behat/basic_usage.feature b/src/addons/mod/quiz/tests/behat/basic_usage.feature index ae004f67da5..a0f7f175922 100755 --- a/src/addons/mod/quiz/tests/behat/basic_usage.feature +++ b/src/addons/mod/quiz/tests/behat/basic_usage.feature @@ -122,7 +122,7 @@ Feature: Attempt a quiz in app Then I should find "Summary of attempt" in the app When I press "Submit all and finish" in the app - And I press "OK" near "Once you submit" in the app + And I press "Submit" near "Once you submit" in the app Then I should find "Review" in the app And I should find "Started on" in the app And I should find "State" in the app @@ -181,7 +181,7 @@ Feature: Attempt a quiz in app But I should not find "Not yet answered" in the app When I press "Submit all and finish" in the app - And I press "OK" in the app + And I press "Submit" in the app Then I should find "Review" in the app And I should find "Finished" in the app And I should find "Not yet graded" in the app @@ -201,7 +201,7 @@ Feature: Attempt a quiz in app And I press "False" in the app And I press "Submit" in the app And I press "Submit all and finish" in the app - And I press "OK" in the app + And I press "Submit" in the app Then I should find "Review" in the app When I replace "/.*/" within "page-addon-mod-quiz-review core-loading > ion-card ion-item:nth-child(1) p:nth-child(2)" with "[Started on date]" diff --git a/src/addons/mod/quiz/tests/behat/quiz_navigation.feature b/src/addons/mod/quiz/tests/behat/quiz_navigation.feature index 63b0db1bfb9..27c1af77dd7 100644 --- a/src/addons/mod/quiz/tests/behat/quiz_navigation.feature +++ b/src/addons/mod/quiz/tests/behat/quiz_navigation.feature @@ -81,7 +81,7 @@ Feature: Attempt a quiz in app Then I should find "Summary of attempt" in the app When I press "Submit all and finish" in the app - And I press "OK" near "Once you submit" in the app + And I press "Submit" near "Once you submit" in the app Then I should find "Review" in the app And I should find "Text of the first question" in the app And I should find "Text of the second question" in the app @@ -131,7 +131,7 @@ Feature: Attempt a quiz in app # And I should find "Not yet answered" within "3" "ion-item" in the app When I press "Submit all and finish" in the app - And I press "OK" near "Once you submit" in the app + And I press "Submit" near "Once you submit" in the app Then I should find "Review" in the app # @todo MOBILE-4350: Uncomment these. # And I should find "Text of the first question" in the app diff --git a/src/theme/theme.base.scss b/src/theme/theme.base.scss index cc0b1a2923b..1e735cc38a9 100644 --- a/src/theme/theme.base.scss +++ b/src/theme/theme.base.scss @@ -516,6 +516,12 @@ ion-alert { .alert-message { user-select: text; flex-shrink: 0; + + ion-card { + margin: 0; + margin-top: 10px; + } + } }