Merge branch 'MDL-85239-master' of https://github.com/NashTechOpenUniversity/moodle
This commit is contained in:
@@ -47,6 +47,9 @@ class attempt_summary_information implements renderable, named_templatable {
|
||||
/** @var array[] The rows of summary data. {@see add_item()} should make the structure clear. */
|
||||
protected array $summarydata = [];
|
||||
|
||||
/** @var string The caption for attempt summary table. */
|
||||
protected string $caption = '';
|
||||
|
||||
/**
|
||||
* Add an item to the summary.
|
||||
*
|
||||
@@ -61,6 +64,15 @@ class attempt_summary_information implements renderable, named_templatable {
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the caption for the summary table.
|
||||
*
|
||||
* @param string $caption
|
||||
*/
|
||||
public function set_caption(string $caption): void {
|
||||
$this->caption = $caption;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an item to the summary just before the given item.
|
||||
*
|
||||
@@ -209,6 +221,9 @@ class attempt_summary_information implements renderable, named_templatable {
|
||||
}
|
||||
}
|
||||
|
||||
// Caption.
|
||||
$summary->set_caption(get_string('summaryofattemptscaption', 'quiz', $attemptobj->get_attempt_number()));
|
||||
|
||||
// Attempt state.
|
||||
$summary->add_item('state', get_string('attemptstate', 'quiz'),
|
||||
quiz_attempt::state_name($attemptobj->get_attempt()->state));
|
||||
@@ -321,6 +336,7 @@ class attempt_summary_information implements renderable, named_templatable {
|
||||
$templatecontext = [
|
||||
'hasitems' => !empty($this->summarydata),
|
||||
'items' => [],
|
||||
'caption' => $this->caption,
|
||||
];
|
||||
foreach ($this->summarydata as $item) {
|
||||
if ($item['title'] instanceof renderable) {
|
||||
|
||||
@@ -58,7 +58,8 @@ echo $output->header();
|
||||
|
||||
// Prepare summary information about this question attempt.
|
||||
$summary = new attempt_summary_information();
|
||||
|
||||
// Set the caption.
|
||||
$summary->set_caption(get_string('summaryofattempt', 'quiz'));
|
||||
// Student name.
|
||||
$userpicture = new user_picture($student);
|
||||
$userpicture->courseid = $attemptobj->get_courseid();
|
||||
|
||||
@@ -1108,6 +1108,7 @@ $string['subplugintype_quizaccess_plural'] = 'Access rules';
|
||||
$string['substitutedby'] = 'will be substituted by';
|
||||
$string['summaryofattempt'] = 'Summary of attempt';
|
||||
$string['summaryofattempts'] = 'Your attempts';
|
||||
$string['summaryofattemptscaption'] = 'Attempt {$a} summary';
|
||||
$string['temporaryblocked'] = 'You are temporarily not allowed to re-attempt the quiz.<br /> You will be able to take another attempt on:';
|
||||
$string['theattempt'] = 'The attempt';
|
||||
$string['theattempt_help'] = 'Whether the student can review the attempt at all.';
|
||||
|
||||
@@ -77,6 +77,8 @@ if ($attemptobj->is_own_attempt()) {
|
||||
|
||||
// Prepare summary informat about this question attempt.
|
||||
$summary = new attempt_summary_information();
|
||||
// Set the caption.
|
||||
$summary->set_caption(get_string('summaryofattempt', 'quiz'));
|
||||
|
||||
// Student name.
|
||||
$userpicture = new user_picture($student);
|
||||
|
||||
@@ -29,11 +29,15 @@
|
||||
{"title": "Completed", "content": "Thursday, 23 November 2023, 9:32 AM"},
|
||||
{"title": "Duration", "content": "3 minutes"},
|
||||
{"title": "Grade", "content": "Not yet graded"}
|
||||
]
|
||||
],
|
||||
"caption": "Summary of attempt"
|
||||
}
|
||||
}}
|
||||
{{#hasitems}}
|
||||
<table class="table generaltable generalbox quizreviewsummary mb-0">
|
||||
{{#caption}}
|
||||
<caption class="sr-only">{{caption}}</caption>
|
||||
{{/caption}}
|
||||
<tbody>
|
||||
{{#items}}
|
||||
<tr>
|
||||
|
||||
@@ -169,6 +169,7 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
|
||||
And I follow "Review attempt"
|
||||
And I click on "1" "link" in the "First question" "question"
|
||||
And I switch to "reviewquestion" window
|
||||
And "Summary of attempt" "table" should exist
|
||||
And the state of "First question" question is shown as "Incorrect"
|
||||
# Now switch to the other quiz attempt using the link at the top, which does not have a redo.
|
||||
And I click on "2" "link" in the "Attempts" "table_row"
|
||||
|
||||
@@ -63,6 +63,7 @@ Feature: Teachers can override the grade for any question
|
||||
And I am on the "Quiz 1 > student1 > Attempt 1" "mod_quiz > Attempt review" page
|
||||
And I follow "Make comment or override mark"
|
||||
And I switch to "commentquestion" window
|
||||
And "Summary of attempt" "table" should exist
|
||||
And I set the field "Comment" to "Administrator's comment"
|
||||
And I select the "p" element in position "0" of the "Comment" TinyMCE editor
|
||||
And I click on the "Image" button for the "Comment" TinyMCE editor
|
||||
|
||||
@@ -37,10 +37,12 @@ Feature: Preview a quiz as a teacher
|
||||
Scenario: Review the quiz attempt
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher"
|
||||
And I follow "Review"
|
||||
And "Attempt 1 summary" "table" should exist
|
||||
Then I should see "25.00 out of 100.00"
|
||||
And I should see "v1 (latest)" in the "Question 1" "question"
|
||||
And I follow "Finish review"
|
||||
And "Review" "link" in the "Attempt 1" "list_item" should be visible
|
||||
And "Attempt 1 summary" "table" should exist
|
||||
|
||||
@javascript
|
||||
Scenario: Review the quiz attempt with custom decimal separator
|
||||
|
||||
Reference in New Issue
Block a user