mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'MDL-71764' of https://github.com/paulholden/moodle
This commit is contained in:
commit
9fed7e6f13
@ -203,8 +203,7 @@ abstract class quiz_attempts_report extends quiz_default_report {
|
|||||||
$headers[] = get_string('firstname');
|
$headers[] = get_string('firstname');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Does not support custom user profile fields (MDL-70456).
|
$extrafields = \core_user\fields::get_identity_fields($this->context);
|
||||||
$extrafields = \core_user\fields::get_identity_fields($this->context, false);
|
|
||||||
foreach ($extrafields as $field) {
|
foreach ($extrafields as $field) {
|
||||||
$columns[] = $field;
|
$columns[] = $field;
|
||||||
$headers[] = \core_user\fields::get_display_name($field);
|
$headers[] = \core_user\fields::get_display_name($field);
|
||||||
@ -218,8 +217,8 @@ abstract class quiz_attempts_report extends quiz_default_report {
|
|||||||
protected function configure_user_columns($table) {
|
protected function configure_user_columns($table) {
|
||||||
$table->column_suppress('picture');
|
$table->column_suppress('picture');
|
||||||
$table->column_suppress('fullname');
|
$table->column_suppress('fullname');
|
||||||
// TODO Does not support custom user profile fields (MDL-70456).
|
|
||||||
$extrafields = \core_user\fields::get_identity_fields($this->context, false);
|
$extrafields = \core_user\fields::get_identity_fields($this->context);
|
||||||
foreach ($extrafields as $field) {
|
foreach ($extrafields as $field) {
|
||||||
$table->column_suppress($field);
|
$table->column_suppress($field);
|
||||||
}
|
}
|
||||||
|
@ -423,10 +423,10 @@ abstract class quiz_attempts_report_table extends table_sql {
|
|||||||
$fields .= "\n(CASE WHEN $this->qmsubselect THEN 1 ELSE 0 END) AS gradedattempt,";
|
$fields .= "\n(CASE WHEN $this->qmsubselect THEN 1 ELSE 0 END) AS gradedattempt,";
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Does not support custom user profile fields (MDL-70456).
|
$userfieldsapi = \core_user\fields::for_identity($this->context)->with_name()
|
||||||
$userfields = \core_user\fields::for_identity($this->context, false)->with_name()
|
|
||||||
->excluding('id', 'idnumber', 'picture', 'imagealt', 'institution', 'department', 'email');
|
->excluding('id', 'idnumber', 'picture', 'imagealt', 'institution', 'department', 'email');
|
||||||
$extrafields = $userfields->get_sql('u')->selects;
|
$userfields = $userfieldsapi->get_sql('u', true, '', '', false);
|
||||||
|
|
||||||
$fields .= '
|
$fields .= '
|
||||||
quiza.uniqueid AS usageid,
|
quiza.uniqueid AS usageid,
|
||||||
quiza.id AS attempt,
|
quiza.id AS attempt,
|
||||||
@ -436,7 +436,7 @@ abstract class quiz_attempts_report_table extends table_sql {
|
|||||||
u.imagealt,
|
u.imagealt,
|
||||||
u.institution,
|
u.institution,
|
||||||
u.department,
|
u.department,
|
||||||
u.email' . $extrafields . ',
|
u.email,' . $userfields->selects . ',
|
||||||
quiza.state,
|
quiza.state,
|
||||||
quiza.sumgrades,
|
quiza.sumgrades,
|
||||||
quiza.timefinish,
|
quiza.timefinish,
|
||||||
@ -450,9 +450,10 @@ abstract class quiz_attempts_report_table extends table_sql {
|
|||||||
|
|
||||||
// This part is the same for all cases. Join the users and quiz_attempts tables.
|
// This part is the same for all cases. Join the users and quiz_attempts tables.
|
||||||
$from = " {user} u";
|
$from = " {user} u";
|
||||||
|
$from .= "\n{$userfields->joins}";
|
||||||
$from .= "\nLEFT JOIN {quiz_attempts} quiza ON
|
$from .= "\nLEFT JOIN {quiz_attempts} quiza ON
|
||||||
quiza.userid = u.id AND quiza.quiz = :quizid";
|
quiza.userid = u.id AND quiza.quiz = :quizid";
|
||||||
$params = array('quizid' => $this->quiz->id);
|
$params = array_merge($userfields->params, ['quizid' => $this->quiz->id]);
|
||||||
|
|
||||||
if ($this->qmsubselect && $this->options->onlygraded) {
|
if ($this->qmsubselect && $this->options->onlygraded) {
|
||||||
$from .= " AND (quiza.state <> :finishedstate OR $this->qmsubselect)";
|
$from .= " AND (quiza.state <> :finishedstate OR $this->qmsubselect)";
|
||||||
|
@ -4,14 +4,16 @@ Feature: Basic use of the Grades report
|
|||||||
As a teacher
|
As a teacher
|
||||||
I need to use the Grades report
|
I need to use the Grades report
|
||||||
|
|
||||||
@javascript
|
Background:
|
||||||
Scenario: Using the Grades report
|
Given the following "custom profile fields" exist:
|
||||||
Given the following "users" exist:
|
| datatype | shortname | name |
|
||||||
| username | firstname | lastname | email | idnumber |
|
| text | fruit | Fruit |
|
||||||
| teacher1 | T1 | Teacher1 | teacher1@example.com | T1000 |
|
And the following "users" exist:
|
||||||
| student1 | S1 | Student1 | student1@example.com | S1000 |
|
| username | firstname | lastname | email | idnumber | profile_field_fruit |
|
||||||
| student2 | S2 | Student2 | student2@example.com | S2000 |
|
| teacher1 | T1 | Teacher1 | teacher1@example.com | T1000 | |
|
||||||
| student3 | S3 | Student3 | student3@example.com | S3000 |
|
| student1 | S1 | Student1 | student1@example.com | S1000 | Apple |
|
||||||
|
| student2 | S2 | Student2 | student2@example.com | S2000 | Banana |
|
||||||
|
| student3 | S3 | Student3 | student3@example.com | S3000 | Pear |
|
||||||
And the following "courses" exist:
|
And the following "courses" exist:
|
||||||
| fullname | shortname | category |
|
| fullname | shortname | category |
|
||||||
| Course 1 | C1 | 0 |
|
| Course 1 | C1 | 0 |
|
||||||
@ -44,6 +46,8 @@ Feature: Basic use of the Grades report
|
|||||||
| 1 | True |
|
| 1 | True |
|
||||||
| 2 | True |
|
| 2 | True |
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Using the Grades report
|
||||||
# Basic check of the Grades report
|
# Basic check of the Grades report
|
||||||
When I log in as "teacher1"
|
When I log in as "teacher1"
|
||||||
And I am on "Course 1" course homepage
|
And I am on "Course 1" course homepage
|
||||||
@ -77,3 +81,14 @@ Feature: Basic use of the Grades report
|
|||||||
And I should see "25.00" in the "S1 Student1" "table_row"
|
And I should see "25.00" in the "S1 Student1" "table_row"
|
||||||
# Check student2's grade
|
# Check student2's grade
|
||||||
And I should see "100.00" in the "S2 Student2" "table_row"
|
And I should see "100.00" in the "S2 Student2" "table_row"
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: View custom user profile fields in the grades report
|
||||||
|
Given the following config values are set as admin:
|
||||||
|
| showuseridentity | email,profile_field_fruit |
|
||||||
|
When I log in as "teacher1"
|
||||||
|
And I am on "Course 1" course homepage
|
||||||
|
And I follow "Quiz 1"
|
||||||
|
And I navigate to "Results > Grades" in current page administration
|
||||||
|
Then I should see "Apple" in the "S1 Student1" "table_row"
|
||||||
|
And I should see "Banana" in the "S2 Student2" "table_row"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user