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'.
This commit is contained in:
Tim Hunt
2024-03-06 13:50:43 +08:00
committed by Ilya Tregubov
parent 2ad6cd5291
commit 76bcbc5ddb
10 changed files with 29 additions and 25 deletions
@@ -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.
@@ -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)) {
+1
View File
@@ -6,3 +6,4 @@ gradetopassnotset,mod_quiz
basicideasofquiz,mod_quiz
completionminattemptsgroup,mod_quiz
grade,mod_quiz
timetaken,mod_quiz
+5 -5
View File
@@ -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';
@@ -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
@@ -24,9 +24,10 @@
"title": "<img src='https://qa.moodledemo.net/pluginfile.php/27/user/icon/boost/f2?rev=5522' class='userpicture' width='35' height='35' alt='It is me!'>",
"content": "<a href='https://qa.moodledemo.net/user/view.php?id=4&amp;course=2'>Sam Student</a>"
},
{"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"}
]
}
+4 -3
View File
@@ -32,9 +32,10 @@
"title": "<img src='https://qa.moodledemo.net/pluginfile.php/27/user/icon/boost/f2?rev=5522' class='userpicture' width='35' height='35' alt='It is me!'>",
"content": "<a href='https://qa.moodledemo.net/user/view.php?id=4&amp;course=2'>Sam Student</a>"
},
{"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"}
]
}
+4 -4
View File
@@ -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"
@@ -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"
+1 -1
View File
@@ -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.