mirror of
https://github.com/moodle/moodle.git
synced 2025-04-26 19:03:38 +02:00
MDL-82100 Quiz\report: Show customised question numbers
This commit is contained in:
parent
5aef789ac6
commit
f06a670a64
@ -383,7 +383,7 @@ class quiz_grading_report extends report_base {
|
|||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
|
|
||||||
$row[] = $this->questions[$counts->slot]->number;
|
$row[] = $this->questions[$counts->slot]->displaynumber;
|
||||||
|
|
||||||
$row[] = $PAGE->get_renderer('question', 'bank')->qtype_icon($this->questions[$counts->slot]->qtype);
|
$row[] = $PAGE->get_renderer('question', 'bank')->qtype_icon($this->questions[$counts->slot]->qtype);
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ Feature: Basic use of the Manual grading report
|
|||||||
| quiz | Quiz 1 | C1 | quiz1 | 1 | tging |
|
| quiz | Quiz 1 | C1 | quiz1 | 1 | tging |
|
||||||
| quiz | Quiz 2 | C1 | quiz2 | 1 | tging |
|
| quiz | Quiz 2 | C1 | quiz2 | 1 | tging |
|
||||||
And quiz "Quiz 1" contains the following questions:
|
And quiz "Quiz 1" contains the following questions:
|
||||||
| question | page |
|
| question | page | displaynumber |
|
||||||
| Short answer 001 | 1 |
|
| Short answer 001 | 1 | 1a |
|
||||||
|
|
||||||
Scenario: Manual grading report without attempts
|
Scenario: Manual grading report without attempts
|
||||||
When I am on the "Quiz 1" "mod_quiz > Manual grading report" page logged in as "teacher1"
|
When I am on the "Quiz 1" "mod_quiz > Manual grading report" page logged in as "teacher1"
|
||||||
@ -98,6 +98,7 @@ Feature: Basic use of the Manual grading report
|
|||||||
And I set the field "Mark" to "0.6"
|
And I set the field "Mark" to "0.6"
|
||||||
And I press "Save and show next"
|
And I press "Save and show next"
|
||||||
And I should see "All selected attempts have been graded. Returning to the list of questions."
|
And I should see "All selected attempts have been graded. Returning to the list of questions."
|
||||||
|
And "Short answer 001" row "Q #" column of "questionstograde" table should contain "1a"
|
||||||
And "Short answer 001" row "To grade" column of "questionstograde" table should contain "0"
|
And "Short answer 001" row "To grade" column of "questionstograde" table should contain "0"
|
||||||
And "Short answer 001" row "Already graded" column of "questionstograde" table should contain "1"
|
And "Short answer 001" row "Already graded" column of "questionstograde" table should contain "1"
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class quiz_overview_report extends attempts_report {
|
|||||||
if ($options->slotmarks) {
|
if ($options->slotmarks) {
|
||||||
foreach ($questions as $slot => $question) {
|
foreach ($questions as $slot => $question) {
|
||||||
$columns[] = 'qsgrade' . $slot;
|
$columns[] = 'qsgrade' . $slot;
|
||||||
$header = get_string('qbrief', 'quiz', $question->number);
|
$header = get_string('qbrief', 'quiz', $question->displaynumber);
|
||||||
if (!$table->is_downloading()) {
|
if (!$table->is_downloading()) {
|
||||||
$header .= '<br />';
|
$header .= '<br />';
|
||||||
} else {
|
} else {
|
||||||
|
@ -46,10 +46,10 @@ Feature: Basic use of the Grades report
|
|||||||
| Test questions | truefalse | TF1 | First question |
|
| Test questions | truefalse | TF1 | First question |
|
||||||
| Test questions | truefalse | TF2 | Second question |
|
| Test questions | truefalse | TF2 | Second question |
|
||||||
And quiz "Quiz 1" contains the following questions:
|
And quiz "Quiz 1" contains the following questions:
|
||||||
| question | page | maxmark |
|
| question | page | maxmark | displaynumber |
|
||||||
| Intro | 1 | |
|
| Intro | 1 | | |
|
||||||
| TF1 | 1 | |
|
| TF1 | 1 | | |
|
||||||
| TF2 | 1 | 3.0 |
|
| TF2 | 1 | 3.0 | 2a |
|
||||||
And user "student1" has attempted "Quiz 1" with responses:
|
And user "student1" has attempted "Quiz 1" with responses:
|
||||||
| slot | response |
|
| slot | response |
|
||||||
| 2 | True |
|
| 2 | True |
|
||||||
@ -68,7 +68,7 @@ Feature: Basic use of the Grades report
|
|||||||
|
|
||||||
# Verify that the right columns are visible
|
# Verify that the right columns are visible
|
||||||
And I should see "Q. 1"
|
And I should see "Q. 1"
|
||||||
And I should see "Q. 2"
|
And I should see "Q. 2a"
|
||||||
And I should not see "Q. 3"
|
And I should not see "Q. 3"
|
||||||
|
|
||||||
# Check student1's grade
|
# Check student1's grade
|
||||||
|
@ -113,6 +113,7 @@ function quiz_report_get_significant_questions($quiz) {
|
|||||||
$slotreport->qtype = $slot->qtype;
|
$slotreport->qtype = $slot->qtype;
|
||||||
$slotreport->length = $slot->length;
|
$slotreport->length = $slot->length;
|
||||||
$slotreport->number = $number;
|
$slotreport->number = $number;
|
||||||
|
$slotreport->displaynumber = $slot->displaynumber ?? $number;
|
||||||
$number += $slot->length;
|
$number += $slot->length;
|
||||||
$slotreport->maxmark = $slot->maxmark;
|
$slotreport->maxmark = $slot->maxmark;
|
||||||
$slotreport->category = $slot->category;
|
$slotreport->category = $slot->category;
|
||||||
|
@ -158,15 +158,15 @@ class quiz_responses_report extends attempts_report {
|
|||||||
foreach ($questions as $id => $question) {
|
foreach ($questions as $id => $question) {
|
||||||
if ($options->showqtext) {
|
if ($options->showqtext) {
|
||||||
$columns[] = 'question' . $id;
|
$columns[] = 'question' . $id;
|
||||||
$headers[] = get_string('questionx', 'question', $question->number);
|
$headers[] = get_string('questionx', 'question', $question->displaynumber);
|
||||||
}
|
}
|
||||||
if ($options->showresponses) {
|
if ($options->showresponses) {
|
||||||
$columns[] = 'response' . $id;
|
$columns[] = 'response' . $id;
|
||||||
$headers[] = get_string('responsex', 'quiz_responses', $question->number);
|
$headers[] = get_string('responsex', 'quiz_responses', $question->displaynumber);
|
||||||
}
|
}
|
||||||
if ($options->showright) {
|
if ($options->showright) {
|
||||||
$columns[] = 'right' . $id;
|
$columns[] = 'right' . $id;
|
||||||
$headers[] = get_string('rightanswerx', 'quiz_responses', $question->number);
|
$headers[] = get_string('rightanswerx', 'quiz_responses', $question->displaynumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ Feature: Basic use of the Responses report
|
|||||||
| questioncategory | qtype | name | template |
|
| questioncategory | qtype | name | template |
|
||||||
| Test questions | numerical | NQ | pi3tries |
|
| Test questions | numerical | NQ | pi3tries |
|
||||||
And quiz "Quiz 1" contains the following questions:
|
And quiz "Quiz 1" contains the following questions:
|
||||||
| question | page | maxmark |
|
| question | page | maxmark | displaynumber |
|
||||||
| NQ | 1 | 3.0 |
|
| NQ | 1 | 3.0 | 1a |
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: Report works when there are no attempts
|
Scenario: Report works when there are no attempts
|
||||||
@ -58,13 +58,14 @@ Feature: Basic use of the Responses report
|
|||||||
And I should not see "Student Two"
|
And I should not see "Student Two"
|
||||||
And I set the field "Attempts from" to "enrolled users who have, or have not, attempted the quiz"
|
And I set the field "Attempts from" to "enrolled users who have, or have not, attempted the quiz"
|
||||||
And I set the field "Which tries" to "All tries"
|
And I set the field "Which tries" to "All tries"
|
||||||
|
And I should see "Response 1a"
|
||||||
And I press "Show report"
|
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 "Response 1aSort by Response 1a Ascending" column of "responses" table should contain "1.0"
|
||||||
And "Student OneReview attempt" row "Status" 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 "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 "Finished" row "Response 1aSort by Response 1a Ascending" column of "responses" table should contain "3.14"
|
||||||
And "Student Two" row "Status" 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 "-"
|
And "Student Two" row "Response 1aSort by Response 1a Ascending" column of "responses" table should contain "-"
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: Report does not allow strange combinations of options
|
Scenario: Report does not allow strange combinations of options
|
||||||
|
@ -890,11 +890,13 @@ class quiz_statistics_report extends report_base {
|
|||||||
$questions = quiz_report_get_significant_questions($quiz);
|
$questions = quiz_report_get_significant_questions($quiz);
|
||||||
$questiondata = [];
|
$questiondata = [];
|
||||||
foreach ($questions as $qs => $question) {
|
foreach ($questions as $qs => $question) {
|
||||||
|
$displaynumber = $question->displaynumber;
|
||||||
if ($question->qtype === 'random') {
|
if ($question->qtype === 'random') {
|
||||||
$question->id = 0;
|
$question->id = 0;
|
||||||
$question->name = get_string('random', 'quiz');
|
$question->name = get_string('random', 'quiz');
|
||||||
$question->questiontext = get_string('random', 'quiz');
|
$question->questiontext = get_string('random', 'quiz');
|
||||||
$question->parenttype = 'random';
|
$question->parenttype = 'random';
|
||||||
|
$question->number = $displaynumber;
|
||||||
$questiondata[$question->slot] = $question;
|
$questiondata[$question->slot] = $question;
|
||||||
} else if ($question->qtype === 'missingtype') {
|
} else if ($question->qtype === 'missingtype') {
|
||||||
$question->id = is_numeric($question->id) ? (int) $question->id : 0;
|
$question->id = is_numeric($question->id) ? (int) $question->id : 0;
|
||||||
@ -905,7 +907,7 @@ class quiz_statistics_report extends report_base {
|
|||||||
$q = question_bank::load_question_data($question->id);
|
$q = question_bank::load_question_data($question->id);
|
||||||
$q->maxmark = $question->maxmark;
|
$q->maxmark = $question->maxmark;
|
||||||
$q->slot = $question->slot;
|
$q->slot = $question->slot;
|
||||||
$q->number = $question->number;
|
$q->number = $displaynumber;
|
||||||
$q->parenttype = null;
|
$q->parenttype = null;
|
||||||
$questiondata[$question->slot] = $q;
|
$questiondata[$question->slot] = $q;
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,10 @@ Feature: Basic use of the Statistics report
|
|||||||
| activity | name | course | idnumber |
|
| activity | name | course | idnumber |
|
||||||
| quiz | Quiz 1 | C1 | quiz1 |
|
| quiz | Quiz 1 | C1 | quiz1 |
|
||||||
And quiz "Quiz 1" contains the following questions:
|
And quiz "Quiz 1" contains the following questions:
|
||||||
| question | page |
|
| question | page | displaynumber |
|
||||||
| Question A | 1 |
|
| Question A | 1 | |
|
||||||
| Question B | 1 |
|
| Question B | 1 | |
|
||||||
| Question C | 2 |
|
| Question C | 2 | 3c |
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: Report works when there are no attempts
|
Scenario: Report works when there are no attempts
|
||||||
@ -64,6 +64,7 @@ Feature: Basic use of the Statistics report
|
|||||||
And "Show chart data" "link" should exist
|
And "Show chart data" "link" should exist
|
||||||
|
|
||||||
# Question A statistics breakdown.
|
# Question A statistics breakdown.
|
||||||
|
And "1" row "Q#" column of "questionstatistics" table should contain "1"
|
||||||
And "1" row "Question name" column of "questionstatistics" table should contain "Question A"
|
And "1" row "Question name" column of "questionstatistics" table should contain "Question A"
|
||||||
And "1" row "Attempts" column of "questionstatistics" table should contain "3"
|
And "1" row "Attempts" column of "questionstatistics" table should contain "3"
|
||||||
And "1" row "Facility index" column of "questionstatistics" table should contain "66.67%"
|
And "1" row "Facility index" column of "questionstatistics" table should contain "66.67%"
|
||||||
@ -74,6 +75,7 @@ Feature: Basic use of the Statistics report
|
|||||||
And "1" row "Discrimination index" column of "questionstatistics" table should contain "50.00%"
|
And "1" row "Discrimination index" column of "questionstatistics" table should contain "50.00%"
|
||||||
|
|
||||||
# Question B statistics breakdown.
|
# Question B statistics breakdown.
|
||||||
|
And "2" row "Q#" column of "questionstatistics" table should contain "2"
|
||||||
And "2" row "Question name" column of "questionstatistics" table should contain "Question B"
|
And "2" row "Question name" column of "questionstatistics" table should contain "Question B"
|
||||||
And "2" row "Attempts" column of "questionstatistics" table should contain "3"
|
And "2" row "Attempts" column of "questionstatistics" table should contain "3"
|
||||||
And "2" row "Facility index" column of "questionstatistics" table should contain "33.33%"
|
And "2" row "Facility index" column of "questionstatistics" table should contain "33.33%"
|
||||||
@ -84,6 +86,7 @@ Feature: Basic use of the Statistics report
|
|||||||
And "2" row "Discrimination index" column of "questionstatistics" table should contain "86.60%"
|
And "2" row "Discrimination index" column of "questionstatistics" table should contain "86.60%"
|
||||||
|
|
||||||
# Question C statistics breakdown.
|
# Question C statistics breakdown.
|
||||||
|
And "3" row "Q#" column of "questionstatistics" table should contain "3c"
|
||||||
And "3" row "Question name" column of "questionstatistics" table should contain "Question C"
|
And "3" row "Question name" column of "questionstatistics" table should contain "Question C"
|
||||||
And "3" row "Attempts" column of "questionstatistics" table should contain "3"
|
And "3" row "Attempts" column of "questionstatistics" table should contain "3"
|
||||||
And "3" row "Facility index" column of "questionstatistics" table should contain "33.33%"
|
And "3" row "Facility index" column of "questionstatistics" table should contain "33.33%"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user