Skip to content

Commit

Permalink
MDL-80900 quiz: refine attempt summary
Browse files Browse the repository at this point in the history
* Move State to above all the times, rather than in the middle.
* Changed 'Completed on' to 'Completed' and 'Submitted on' to 'Submitted'.
  • Loading branch information
timhunt authored and ilyatregubov committed Mar 6, 2024
1 parent 2ad6cd5 commit 76bcbc5
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion mod/quiz/classes/local/reports/attempts_report_table.php
Expand Up @@ -232,7 +232,7 @@ public function col_timefinish($attempt) {
}

/**
* 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.
Expand Down
9 changes: 5 additions & 4 deletions mod/quiz/classes/output/attempt_summary_information.php
Expand Up @@ -129,6 +129,10 @@ public static function create_for_attempt(
}
}

// 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();
Expand All @@ -150,13 +154,10 @@ public static function create_for_attempt(

$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)) {
Expand Down
1 change: 1 addition & 0 deletions mod/quiz/lang/en/deprecated.txt
Expand Up @@ -6,3 +6,4 @@ gradetopassnotset,mod_quiz
basicideasofquiz,mod_quiz
completionminattemptsgroup,mod_quiz
grade,mod_quiz
timetaken,mod_quiz
10 changes: 5 additions & 5 deletions mod/quiz/lang/en/quiz.php
Expand Up @@ -88,7 +88,7 @@
$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';
Expand All @@ -114,7 +114,7 @@
$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';
Expand Down Expand Up @@ -182,7 +182,7 @@
$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';
Expand Down Expand Up @@ -994,7 +994,7 @@
$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';
Expand Down Expand Up @@ -1030,7 +1030,6 @@
$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';
Expand Down Expand Up @@ -1092,3 +1091,4 @@

// Deprecated since Moodle 4.4.
$string['grade'] = 'Grade';
$string['timetaken'] = 'Time taken';
4 changes: 2 additions & 2 deletions mod/quiz/report/responses/tests/behat/basic.feature
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions mod/quiz/templates/attempt_summary_information.mustache
Expand Up @@ -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"}
]
}
Expand Down
7 changes: 4 additions & 3 deletions mod/quiz/templates/list_of_attempts.mustache
Expand Up @@ -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"}
]
}
Expand Down
8 changes: 4 additions & 4 deletions mod/quiz/tests/behat/attempt_basic.feature
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions mod/quiz/tests/behat/attempt_review_options.feature
Expand Up @@ -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"
Expand All @@ -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"
2 changes: 1 addition & 1 deletion mod/quiz/tests/external/reopen_attempt_test.php
Expand Up @@ -170,7 +170,7 @@ protected function create_attempt_at_quiz_with_one_shortanswer_question(
// 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.
Expand Down

0 comments on commit 76bcbc5

Please sign in to comment.