From 76bcbc5ddb36db2ab78032d9f4e825efb82031d7 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Tue, 13 Feb 2024 18:58:55 +0000 Subject: [PATCH] MDL-80900 quiz: refine attempt summary * Move State to above all the times, rather than in the middle. * Changed 'Completed on' to 'Completed' and 'Submitted on' to 'Submitted'. --- .../classes/local/reports/attempts_report_table.php | 2 +- .../classes/output/attempt_summary_information.php | 9 +++++---- mod/quiz/lang/en/deprecated.txt | 1 + mod/quiz/lang/en/quiz.php | 10 +++++----- mod/quiz/report/responses/tests/behat/basic.feature | 4 ++-- .../templates/attempt_summary_information.mustache | 7 ++++--- mod/quiz/templates/list_of_attempts.mustache | 7 ++++--- mod/quiz/tests/behat/attempt_basic.feature | 8 ++++---- mod/quiz/tests/behat/attempt_review_options.feature | 4 ++-- mod/quiz/tests/external/reopen_attempt_test.php | 2 +- 10 files changed, 29 insertions(+), 25 deletions(-) diff --git a/mod/quiz/classes/local/reports/attempts_report_table.php b/mod/quiz/classes/local/reports/attempts_report_table.php index 9fed77806b2..f63a0d67749 100644 --- a/mod/quiz/classes/local/reports/attempts_report_table.php +++ b/mod/quiz/classes/local/reports/attempts_report_table.php @@ -232,7 +232,7 @@ abstract class attempts_report_table extends \table_sql { } /** - * Generate the display of the time taken column. + * Generate the display of the duration column. * * @param stdClass $attempt the table row being output. * @return string HTML content to go inside the td. diff --git a/mod/quiz/classes/output/attempt_summary_information.php b/mod/quiz/classes/output/attempt_summary_information.php index 6ca0a36d94e..9da72232bf8 100644 --- a/mod/quiz/classes/output/attempt_summary_information.php +++ b/mod/quiz/classes/output/attempt_summary_information.php @@ -129,6 +129,10 @@ class attempt_summary_information implements renderable, named_templatable { } } + // Attempt state. + $summary->add_item('state', get_string('attemptstate', 'quiz'), + quiz_attempt::state_name($attemptobj->get_attempt()->state)); + // Timing information. $attempt = $attemptobj->get_attempt(); $quiz = $attemptobj->get_quiz(); @@ -150,13 +154,10 @@ class attempt_summary_information implements renderable, named_templatable { $summary->add_item('startedon', get_string('startedon', 'quiz'), userdate($attempt->timestart)); - $summary->add_item('state', get_string('attemptstate', 'quiz'), - quiz_attempt::state_name($attemptobj->get_attempt()->state)); - if ($attempt->state == quiz_attempt::FINISHED) { $summary->add_item('completedon', get_string('completedon', 'quiz'), userdate($attempt->timefinish)); - $summary->add_item('timetaken', get_string('timetaken', 'quiz'), $timetaken); + $summary->add_item('timetaken', get_string('attemptduration', 'quiz'), $timetaken); } if (!empty($overtime)) { diff --git a/mod/quiz/lang/en/deprecated.txt b/mod/quiz/lang/en/deprecated.txt index 5a1843cf359..e6e4750db23 100644 --- a/mod/quiz/lang/en/deprecated.txt +++ b/mod/quiz/lang/en/deprecated.txt @@ -6,3 +6,4 @@ gradetopassnotset,mod_quiz basicideasofquiz,mod_quiz completionminattemptsgroup,mod_quiz grade,mod_quiz +timetaken,mod_quiz diff --git a/mod/quiz/lang/en/quiz.php b/mod/quiz/lang/en/quiz.php index df4f3ef522e..d8b5b082bf6 100644 --- a/mod/quiz/lang/en/quiz.php +++ b/mod/quiz/lang/en/quiz.php @@ -88,7 +88,7 @@ $string['asshownoneditscreen'] = 'As shown on the edit screen'; $string['attempt'] = 'Attempt {$a}'; $string['attemptalreadyclosed'] = 'This attempt has already been finished.'; $string['attemptclosed'] = 'Attempt has not closed yet'; -$string['attemptduration'] = 'Time taken'; +$string['attemptduration'] = 'Duration'; $string['attemptedon'] = 'Attempted on'; $string['attempterror'] = 'You are not allowed to attempt this quiz at this time because: {$a}'; $string['attempterrorinvalid'] = 'Invalid quiz attempt ID'; @@ -114,7 +114,7 @@ $string['attemptsnum'] = 'Attempts: {$a}'; $string['attemptsnumthisgroup'] = 'Attempts: {$a->total} ({$a->group} from this group)'; $string['attemptsnumyourgroups'] = 'Attempts: {$a->total} ({$a->group} from your groups)'; $string['attemptsonly'] = 'Show only students with attempts'; -$string['attemptstate'] = 'State'; +$string['attemptstate'] = 'Status'; $string['attemptstillinprogress'] = 'Attempt still in progress'; $string['attemptsummarytitle'] = '{$a}: Attempt summary'; $string['attemptsunlimited'] = 'Unlimited attempts'; @@ -182,7 +182,7 @@ $string['closereview'] = 'Close review'; $string['comment'] = 'Comment'; $string['commentorgrade'] = 'Make comment or override grade'; $string['comments'] = 'Comments'; -$string['completedon'] = 'Completed on'; +$string['completedon'] = 'Completed'; $string['completiondetail:minattempts'] = 'Make attempts: {$a}'; $string['completiondetail:passorexhaust'] = 'Receive a pass grade or complete all available attempts'; $string['completionminattempts'] = 'Minimum attempts'; @@ -994,7 +994,7 @@ $string['specificapathnotonquestion'] = 'The specified file path is not on the s $string['specificquestionnotonquiz'] = 'Specified question is not on the specified quiz'; $string['startagain'] = 'Start again'; $string['startattempt'] = 'Start attempt'; -$string['startedon'] = 'Started on'; +$string['startedon'] = 'Started'; $string['startnewpreview'] = 'Start a new preview'; $string['stateabandoned'] = 'Never submitted'; $string['statefinished'] = 'Finished'; @@ -1030,7 +1030,6 @@ $string['timelimit_link'] = 'mod/quiz/timing'; $string['timelimitexeeded'] = 'Sorry! Quiz time limit exceeded!'; $string['timestr'] = '%H:%M:%S on %d/%m/%y'; $string['timesup'] = 'Time is up!'; -$string['timetaken'] = 'Time taken'; $string['timing'] = 'Timing'; $string['tofile'] = 'to file'; $string['tolerance'] = 'Tolerance'; @@ -1092,3 +1091,4 @@ $string['completionminattemptsgroup'] = 'Require attempts'; // Deprecated since Moodle 4.4. $string['grade'] = 'Grade'; +$string['timetaken'] = 'Time taken'; diff --git a/mod/quiz/report/responses/tests/behat/basic.feature b/mod/quiz/report/responses/tests/behat/basic.feature index a6dd5d5f5d2..7070b04f484 100644 --- a/mod/quiz/report/responses/tests/behat/basic.feature +++ b/mod/quiz/report/responses/tests/behat/basic.feature @@ -60,10 +60,10 @@ Feature: Basic use of the Responses report And I set the field "Which tries" to "All tries" And I press "Show report" And "Student OneReview attempt" row "Response 1Sort by Response 1 Ascending" column of "responses" table should contain "1.0" - And "Student OneReview attempt" row "State" column of "responses" table should contain "" + And "Student OneReview attempt" row "Status" column of "responses" table should contain "" And "Finished" row "Grade/100.00Sort by Grade/100.00 Ascending" column of "responses" table should contain "33.33" And "Finished" row "Response 1Sort by Response 1 Ascending" column of "responses" table should contain "3.14" - And "Student Two" row "State" column of "responses" table should contain "-" + And "Student Two" row "Status" column of "responses" table should contain "-" And "Student Two" row "Response 1Sort by Response 1 Ascending" column of "responses" table should contain "-" @javascript diff --git a/mod/quiz/templates/attempt_summary_information.mustache b/mod/quiz/templates/attempt_summary_information.mustache index c622a8fb167..af6ddc0b7fb 100644 --- a/mod/quiz/templates/attempt_summary_information.mustache +++ b/mod/quiz/templates/attempt_summary_information.mustache @@ -24,9 +24,10 @@ "title": "It is me!", "content": "Sam Student" }, - {"title": "State", "content": "Finished"}, - {"title": "Started on", "content": "Thursday, 23 November 2023, 9:29 AM"}, - {"title": "Completed on", "content": "Thursday, 23 November 2023, 9:32 AM"}, + {"title": "Status", "content": "Finished"}, + {"title": "Started", "content": "Thursday, 23 November 2023, 9:29 AM"}, + {"title": "Completed", "content": "Thursday, 23 November 2023, 9:32 AM"}, + {"title": "Duration", "content": "3 minutes"}, {"title": "Grade", "content": "Not yet graded"} ] } diff --git a/mod/quiz/templates/list_of_attempts.mustache b/mod/quiz/templates/list_of_attempts.mustache index 17ccfab225b..b29334ed68f 100644 --- a/mod/quiz/templates/list_of_attempts.mustache +++ b/mod/quiz/templates/list_of_attempts.mustache @@ -32,9 +32,10 @@ "title": "It is me!", "content": "Sam Student" }, - {"title": "State", "content": "Finished"}, - {"title": "Started on", "content": "Thursday, 23 November 2023, 9:29 AM"}, - {"title": "Completed on", "content": "Thursday, 23 November 2023, 9:32 AM"}, + {"title": "Status", "content": "Finished"}, + {"title": "Started", "content": "Thursday, 23 November 2023, 9:29 AM"}, + {"title": "Completed", "content": "Thursday, 23 November 2023, 9:32 AM"}, + {"title": "Duration", "content": "3 minutes"}, {"title": "Grade", "content": "Not yet graded"} ] } diff --git a/mod/quiz/tests/behat/attempt_basic.feature b/mod/quiz/tests/behat/attempt_basic.feature index cf067987f05..56ce1db76a0 100644 --- a/mod/quiz/tests/behat/attempt_basic.feature +++ b/mod/quiz/tests/behat/attempt_basic.feature @@ -66,10 +66,10 @@ Feature: Attempt a quiz | 2 | False | When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student" And I follow "Review" - Then I should see "Started on" - And I should see "State" - And I should see "Completed on" - And I should see "Time taken" + And I should see "Status" + Then I should see "Started" + And I should see "Completed" + And I should see "Duration" And I should see "Marks" And I should see "Grade" And I should see "25.00 out of 100.00" diff --git a/mod/quiz/tests/behat/attempt_review_options.feature b/mod/quiz/tests/behat/attempt_review_options.feature index d33d45fb1d9..2b8c0dce980 100644 --- a/mod/quiz/tests/behat/attempt_review_options.feature +++ b/mod/quiz/tests/behat/attempt_review_options.feature @@ -44,7 +44,7 @@ Feature: Allow settings to show Max marks and Marks, Max marks only, or hide the And I press "Finish attempt ..." And I press "Submit all and finish" And I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue" - Then I should see "Finished" in the "State" "table_row" + Then I should see "Finished" in the "Status" "table_row" And I should see "Question 1" in the ".info" "css_element" And I should see "Correct" in the ".info" "css_element" And I should see "Mark 2.00 out of 2.00" in the ".info" "css_element" @@ -58,7 +58,7 @@ Feature: Allow settings to show Max marks and Marks, Max marks only, or hide the And I press "Finish attempt ..." And I press "Submit all and finish" And I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue" - And I should see "Finished" in the "State" "table_row" + And I should see "Finished" in the "Status" "table_row" And I should see "Question 1" in the ".info" "css_element" And I should see "Correct" in the ".info" "css_element" And I should see "Mark 2.00 out of 2.00" in the ".info" "css_element" diff --git a/mod/quiz/tests/external/reopen_attempt_test.php b/mod/quiz/tests/external/reopen_attempt_test.php index 2e5ec8cdea2..e15025358de 100644 --- a/mod/quiz/tests/external/reopen_attempt_test.php +++ b/mod/quiz/tests/external/reopen_attempt_test.php @@ -170,7 +170,7 @@ class reopen_attempt_test extends externallib_advanced_testcase { // Attempt goes overdue (e.g. if cron ran). $attemptobj->process_abandon($timeclose + 2 * get_config('quiz', 'graceperiodmin'), false); } else if ($attemptstate !== quiz_attempt::IN_PROGRESS) { - throw new coding_exception('State ' . $attemptstate . ' not currently supported.'); + throw new coding_exception('Status ' . $attemptstate . ' not currently supported.'); } // Set current user to admin before we return.