Compare commits

..

65 Commits

Author SHA1 Message Date
Jun Pataleta a11ca2d1ff Moodle release 3.11.17 2023-10-07 11:30:05 +08:00
Sara Arjona e2d19fccdd weekly release 3.11.16+ 2023-10-06 14:02:42 +02:00
Paul Holden 6e211165a5 MDL-79310 enrol: restrict searched users to those user can view. 2023-10-04 14:32:16 +08:00
Paul Holden cb041cbdf6 MDL-79310 forumreport_summary: report only on users who can be viewed. 2023-10-04 14:32:15 +08:00
Paul Holden e2e653ea38 MDL-79310 mod_forum: ensure only visible users can be exported. 2023-10-04 14:32:15 +08:00
Mikel Martín c5ff2f6ab2 MDL-79509 mod_wiki: Improve comment editing 2023-10-04 02:04:16 +02:00
Paul Holden 73280a536f MDL-72249 message: stricter cleaning of processor type parameter. 2023-10-04 02:04:16 +02:00
Paul Holden 119feea95d MDL-79426 gradeimport_csv: safely preview CSV content during import. 2023-10-04 02:04:16 +02:00
Paul Holden ae87081d8f MDL-79455 tool_uploadcourse: clean course data fields individually. 2023-10-04 02:04:16 +02:00
Paul Holden c7969fb552 MDL-79455 tool_uploadcourse: safe preview of uploaded course data. 2023-10-04 02:04:16 +02:00
Paul Holden 1f2fbeb50c MDL-79409 mod_imscp: appropriate unserialization of package structure. 2023-10-04 02:04:16 +02:00
Paul Holden c7728de187 MDL-79408 mod_lesson: safer unserializing/comparison of properties. 2023-10-04 02:04:16 +02:00
David Woloszyn 9ecef71191 MDL-77846 core: Make endpoint revision number checks stricter
In some places we prevented cache poisoning, in others we did not. We
also did not place any restriction on the minimum value for a revision.

This change introduces a new set of functions for configonly endpoints
which validates the revision numbers passed in. If the revision is
either too old, or too new, it is rejected and the file content is not
cached. The content is still served, but caching headers are not sent,
and any local storage caching is prevented.

The current time is used as the maximum version, with 60 seconds added
to allow for any clock skew between cluster nodes. Previously some
locations used one hour, but there should never be such a large clock
skew on a correctly configured system.

Co-authored-by: Andrew Nicols <andrew@nicols.co.uk>
2023-10-04 02:04:16 +02:00
Huong Nguyen 691c09afac MDL-66730 core_course: Improve permission check for category moving
Co-authored-by: Erica Bithell <egb10@cam.ac.uk>
2023-10-04 02:04:16 +02:00
Paul Holden 17d208e98b MDL-78820 h5p: use fullname of current user as the xAPI actor name. 2023-10-04 02:04:16 +02:00
meirzamoodle 382d16e311 MDL-78969 oauth2: remove auto-login after successful confirmation
With the new flow, users can go to the login page from the confirmed page,
and if the user successfully logs in, the user will be directed to the confirmed page.
To avoid that, the confirmed page can only be seen by users who are not logged in.
2023-10-04 02:04:16 +02:00
Jun Pataleta b807f99700 weekly release 3.11.16+ 2023-10-04 07:49:27 +08:00
Huong Nguyen 79fe14d66f Merge branch 'MDL-79247_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2023-10-03 09:58:52 +07:00
Eloy Lafuente (stronk7) ee20a85b7c MDL-79247 forum: Workaround same-time discussion modified dates bug
Within the forum_get_discussion_neighbours() function of forum
when the discussions timemodified (last post) is the same, there
is a bug that does strange things when calculating the prev and
next discussions.

Note that, in real life, this is really hard to achieve, but in tests,
when multiple discussions and post can be created by generators in the
same second (specially when the test machine is quick), chances of
facing that problem are higher.

By adding 1 second wait, we ensure that the discussions won't have
the same timemodified (last post) and workaround the problem.

No mater of that, the problem deserves an issue to be created
so we guarantee from code that it also works ok when the same
timemodified (last post) situation happens.
2023-10-01 23:47:32 +02:00
Eloy Lafuente (stronk7) d47d059ca0 MDL-79247 forum: Make discussion list ordering deterministic
Note that normally this doesn't matter much, but there are situations
when we want the discussion list ordering fully consistent /
deterministic.

Specifically, when discussions (or forum posts )are created in the
same second, or when the discussion titles are repeated, or 2
discussions have the same number of votes... (any criteria in general),
in the context of testing, we don't want the order
to be non-consistent, so we need to provide an extra sorting
criterion to make it fully deterministic.

So, in this case, we are adding a sort by discussion.id <<DIRECTION>>
that is an unique value, primary key... so cheap to calculate and,
that way, when the 1st sorting column has repeated values, the id
will decide.
2023-10-01 23:47:32 +02:00
Jun Pataleta 94695eb456 weekly release 3.11.16+ 2023-09-29 22:07:32 +08:00
Ilya Tregubov 972fc66150 Merge branch 'MDL-79360/311' of https://github.com/skodak/moodle into MOODLE_311_STABLE 2023-09-28 09:39:41 +08:00
Sara Arjona f31ece632b weekly release 3.11.16+ 2023-09-15 17:34:28 +02:00
Petr Skoda 5394d544e9 MDL-79360 filter: fix nolink tag regression from MDL-77525 2023-09-15 12:46:00 +02:00
Ilya Tregubov eba8369828 Merge branch 'MDL-79220-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-09-14 17:44:40 +08:00
Ilya Tregubov 3a5ca89951 Merge branch 'MDL-79195-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-09-14 09:39:01 +08:00
Ilya Tregubov 113b846fa9 Merge branch 'MDL-78806-311' of https://github.com/junpataleta/moodle into MOODLE_311_STABLE 2023-09-13 10:56:32 +08:00
Eloy Lafuente (stronk7) 4b72a9bf3f weekly release 3.11.16+ 2023-09-12 18:54:17 +02:00
Angelia Dela Cruz 5a2f76afa8 MDL-79195 core_course: Activity and resource description display behat 2023-09-12 12:54:19 +08:00
Huong Nguyen 52377ed1eb Merge branch 'MDL-79246-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2023-09-12 08:52:19 +07:00
Jun Pataleta 5cf07cf084 MDL-78806 mod_assign: Use new Behat step for checking page title 2023-09-10 23:34:31 +08:00
Jun Pataleta d61bd0f37f MDL-78806 behat: Create a step that for checking the page title
Create a Behat step "the page title should contain ':title'" to check
the page title.
2023-09-10 23:34:31 +08:00
Jun Pataleta 8a0e29ef91 weekly release 3.11.16+ 2023-09-08 22:35:24 +08:00
Angelia Dela Cruz b436c50274 MDL-79220 mod_glossary: Behat for glossary entry with attachment 2023-09-07 10:52:00 +08:00
Ilya Tregubov 605edbd719 Merge branch 'MDL-76459_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2023-09-06 10:04:13 +08:00
Andrew Nicols c30664ffc9 MDL-79246 gradingform_rubric: Use i_click_on for behat clicks 2023-09-04 09:13:16 +08:00
Eloy Lafuente (stronk7) 63111e47bf MDL-76459 xmldb: Add environmental check to verify $CFG->prefix
While, right now, sites using long (> 10 chars) $CFG->prefix
can continue working (because we still don't have any table
> 28 chars), as soon as some new table with long name is added,
it won't work with PostgreSQL anymore (if the 63 limit is raised).

Hence, this environmental check will verify on both install and
upgrade that the $CFG->prefix is always <= 10 chars.

Sites with longer prefixes will need to rename all their tables
(and maybe other objects, depending on the dbtype) to use a shorter
prefix.
2023-09-02 09:22:44 +02:00
Andrew Nicols 9b652a2582 weekly release 3.11.16+ 2023-09-02 08:18:44 +08:00
Andrew Nicols bce7262140 Merge branch 'MDL-77831-311' of https://github.com/mickhawkins/moodle into MOODLE_311_STABLE 2023-09-01 10:38:58 +08:00
Jun Pataleta 70612970af Merge branch 'MDL-79017-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2023-08-31 20:31:45 +08:00
Michael Hawkins e13ca87976 MDL-77831 core: Updated security.txt expiry and added additional info 2023-08-31 18:30:08 +08:00
Huong Nguyen 3179d4ec0e Merge branch 'MDL-79207-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-08-31 12:28:01 +07:00
Angelia Dela Cruz fc85f207c1 MDL-79207 core_course: Behat coverage for activity and resource deletion 2023-08-31 11:28:58 +08:00
Jun Pataleta 2863ae670e weekly release 3.11.16+ 2023-08-26 11:03:35 +08:00
Jun Pataleta d5f69200ea Merge branch 'MDL-79015-311-fix' of https://github.com/lameze/moodle into MOODLE_311_STABLE 2023-08-25 09:54:59 +08:00
Simey Lameze f712df8c43 MDL-79015 behat: make verification step more specific 2023-08-25 09:04:26 +08:00
Sara Arjona 6caf5df4a5 Merge branch 'MDL-78965-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-08-24 16:38:59 +02:00
Jun Pataleta 74cf92acb4 Merge branch 'MDL-79015-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-08-24 15:53:27 +08:00
Angelia Dela Cruz 4ae3175b67 MDL-78965 mod_quiz: Behat coverage for quiz with certainty-based marking 2023-08-24 15:26:26 +08:00
Angelia Dela Cruz 1d02e9afab MDL-79015 mod_lesson: Behat coverage for lesson with access restriction 2023-08-24 13:44:40 +08:00
Jun Pataleta 696d6390d4 Merge branch 'MDL-78941-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-08-24 13:05:28 +08:00
Angelia Dela Cruz 14d0110ac6 MDL-78941 mod_quiz: Behat coverage for student flagging quiz questions 2023-08-24 11:34:22 +08:00
Huong Nguyen 3c25374cc4 Merge branch 'MDL-78843-311' of https://github.com/lameze/moodle into MOODLE_311_STABLE 2023-08-24 08:58:56 +07:00
Paul Holden 8461a18143 MDL-79017 core: re-factor method to unserialize array.
We can use the existing helper for object unserialization as the
base for this method, rather than manual string parsing.
2023-08-21 21:02:51 +01:00
Ilya Tregubov a1dee0fff4 weekly release 3.11.16+ 2023-08-18 11:24:08 +08:00
Eloy Lafuente (stronk7) f5f6c30829 Merge branch 'MDL-78684-311-fix-2' of https://github.com/lameze/moodle into MOODLE_311_STABLE 2023-08-17 19:58:08 +02:00
Simey Lameze 7c45d12dce MDL-78684 behat: fix behat failures 2023-08-17 21:16:31 +08:00
Jun Pataleta b87e6ac0e6 Merge branch 'MDL-78938-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2023-08-17 09:57:04 +08:00
Andrew Nicols b89030e3ee Merge branch 'MDL-77695-311' of https://github.com/lameze/moodle into MOODLE_311_STABLE 2023-08-16 23:23:50 +08:00
Andrew Nicols b0f04ad753 Merge branch 'MDL-78684-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-08-16 22:45:15 +08:00
Simey Lameze b24d54ac5a MDL-77695 behat: use automatic completion to award badges 2023-08-16 21:16:11 +08:00
Andrew Nicols 307c7244f0 MDL-78938 course: Wrap manual completion toggle in pending
This commit makes two changes to reduce random failures in behat:
- wrap the toggling of manually configured completion in pendingjs
- set the loading spinner content without forcing the completion toggle
  ws to wait for the loading spinner to update.
2023-08-16 21:03:03 +08:00
Andrew Nicols 5ddc9ac171 MDL-78938 report_progres: Wrap completion status update in pending 2023-08-16 21:03:03 +08:00
Simey Lameze d51b5bf5b1 MDL-78843 behat: update get_forum_id to search for idnumber or name
This commit also converts manual steps to create discussions on the
Annoucements forum to data generator.
2023-08-10 10:13:50 +08:00
Angelia Dela Cruz 59dd8d9c07 MDL-78684 Behat: Replace gradebook navigation to use page resolvers
This commit also does other things such as:
- Replace manual steps to setup gradebook by data generators
- Added support for outcomes and scales page resolvers
- Behat clean up
2023-08-01 15:52:07 +08:00
114 changed files with 1235 additions and 843 deletions
+2
View File
@@ -4301,6 +4301,8 @@
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mod_assignment" level="required">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_db_prefix_length" level="required">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
@@ -105,8 +105,7 @@ Feature: Set up contextual data for tests
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
When I log in as "student1"
And I am on "Course 1" course homepage
When I am on the "Course 1" course page logged in as student1
Then I should see "Topic 1"
Scenario: Add role assigns
@@ -140,17 +139,11 @@ Feature: Set up contextual data for tests
When I log in as "user1"
And I am on site homepage
Then "Edit settings" "link" should exist in current page administration
And I log out
And I log in as "user2"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as user2
And "Turn editing on" "button" should exist
And I log out
And I log in as "user3"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as user3
And "Turn editing on" "button" should exist
And I log out
And I log in as "user4"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as user4
And "Turn editing on" "button" should exist
And I log out
And I log in as "user5"
@@ -192,8 +185,7 @@ Feature: Set up contextual data for tests
And the following "activities" exist:
| activity | name | intro | course | idnumber | grade |
| assign | Test assignment name with scale | Test assignment description | C1 | assign1 | Test Scale 1 |
When I log in as "admin"
And I am on "Course 1" course homepage
When I am on the "Course 1" course page logged in as admin
Then I should see "Test assignment name"
# Assignment 2.2 module type is disabled by default
# And I should see "Test assignment22 name"
@@ -311,9 +303,7 @@ Feature: Set up contextual data for tests
And the following "grade categories" exist:
| fullname | course | gradecategory |
| Grade sub category 2 | C1 | Grade category 1 |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
When I am on the "Course 1" "grades > Grader report > View" page logged in as "admin"
Then I should see "Grade category 1"
And I should see "Grade sub category 2"
@@ -334,9 +324,7 @@ Feature: Set up contextual data for tests
| itemname | course | gradecategory |
| Test Grade Item 2 | C1 | Grade category 1 |
| Test Grade Item 3 | C1 | Grade sub category 2 |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
When I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
Then I should see "Test Grade Item 1"
And I follow "Edit Test Grade Item 1"
And I expand all fieldsets
@@ -362,9 +350,7 @@ Feature: Set up contextual data for tests
And the following "scales" exist:
| name | scale |
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Scales" in the course gradebook
When I am on the "Course 1" "grades > scales" page logged in as admin
Then I should see "Test Scale 1"
And I should see "Disappointing, Good, Very good, Excellent"
@@ -383,9 +369,7 @@ Feature: Set up contextual data for tests
| Grade outcome 2 | OT2 | C1 | Test Scale 1 |
And the following config values are set as admin:
| enableoutcomes | 1 |
When I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Outcomes"
When I am on the "Course 1" "grades > outcomes" page logged in as admin
Then I should see "Grade outcome 1" in the "#addoutcomes" "css_element"
And I should see "Grade outcome 2" in the "#removeoutcomes" "css_element"
And I follow "Edit outcomes"
@@ -59,9 +59,6 @@ Feature: Backup user data
And I navigate to "Recycle bin" in current page administration
And I should see "Quiz 1"
And I click on "Restore" "link" in the "region-main" "region"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I navigate to "User report" in the course gradebook
When I am on the "Course 1" "grades > User report > View" page logged in as "student1"
Then "Quiz 1" row "Grade" column of "user-grade" table should contain "5"
And "Quiz 1" row "Percentage" column of "user-grade" table should contain "50"
+6 -3
View File
@@ -173,13 +173,16 @@ class tool_uploadcourse_tracker {
} else {
$outcome = $OUTPUT->pix_icon('i/invalid', '');
}
echo html_writer::start_tag('tr', array('class' => 'r' . $this->rownb % 2));
echo html_writer::tag('td', $line, array('class' => 'c' . $ci++));
echo html_writer::tag('td', $outcome, array('class' => 'c' . $ci++));
echo html_writer::tag('td', isset($data['id']) ? $data['id'] : '', array('class' => 'c' . $ci++));
echo html_writer::tag('td', isset($data['shortname']) ? $data['shortname'] : '', array('class' => 'c' . $ci++));
echo html_writer::tag('td', isset($data['fullname']) ? $data['fullname'] : '', array('class' => 'c' . $ci++));
echo html_writer::tag('td', isset($data['idnumber']) ? $data['idnumber'] : '', array('class' => 'c' . $ci++));
// Ensure our data is suitable for HTML output.
echo html_writer::tag('td', isset($data['shortname']) ? s($data['shortname']) : '', array('class' => 'c' . $ci++));
echo html_writer::tag('td', isset($data['fullname']) ? s($data['fullname']) : '', array('class' => 'c' . $ci++));
echo html_writer::tag('td', isset($data['idnumber']) ? s($data['idnumber']) : '', array('class' => 'c' . $ci++));
echo html_writer::tag('td', $status, array('class' => 'c' . $ci++));
echo html_writer::end_tag('tr');
}
+11 -9
View File
@@ -40,7 +40,7 @@ if (!\auth_oauth2\api::is_enabled()) {
$confirmed = $auth->user_confirm($username, $usersecret);
if ($confirmed == AUTH_CONFIRM_ALREADY) {
if ($confirmed == AUTH_CONFIRM_ALREADY && !isloggedin()) {
$user = get_complete_user_data('username', $username);
$PAGE->navbar->add(get_string("alreadyconfirmed"));
$PAGE->set_title(get_string("alreadyconfirmed"));
@@ -61,11 +61,7 @@ if ($confirmed == AUTH_CONFIRM_ALREADY) {
print_error('cannotfinduser', '', '', s($username));
}
if (!$user->suspended) {
complete_user_login($user);
\core\session\manager::apply_concurrent_login_limit($user->id, session_id());
if ($user->id == $USER->id) {
// Check where to go, $redirect has a higher preference.
if (empty($redirect) and !empty($SESSION->wantsurl) ) {
$redirect = $SESSION->wantsurl;
@@ -82,14 +78,20 @@ if ($confirmed == AUTH_CONFIRM_ALREADY) {
$PAGE->set_heading($COURSE->fullname);
echo $OUTPUT->header();
echo $OUTPUT->box_start('generalbox centerpara boxwidthnormal boxaligncenter');
echo "<h3>".get_string("thanks").", ". fullname($USER) . "</h3>\n";
echo "<h3>".get_string("thanks").", ". fullname($user) . "</h3>\n";
echo "<p>".get_string("confirmed")."</p>\n";
echo $OUTPUT->single_button("$CFG->wwwroot/course/", get_string('courses'));
if (!isloggedin() || isguestuser()) {
echo $OUTPUT->single_button(get_login_url(), get_string('login'));
} else {
echo $OUTPUT->single_button("$CFG->wwwroot/login/logout.php", get_string('logout'));
}
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
exit;
} else {
\core\notification::error(get_string('confirmationinvalid', 'auth_oauth2'));
if (!isloggedin()) {
\core\notification::error(get_string('confirmationinvalid', 'auth_oauth2'));
}
}
redirect("$CFG->wwwroot/");
+11 -4
View File
@@ -225,12 +225,19 @@ Feature: Award badges
@javascript
Scenario: Award badge on course completion
Given I log in as "teacher1"
Given the following "activity" exists:
| activity | chat |
| course | C1 |
| name | Music history |
| section | 1 |
| completion | 2 |
| completionview | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Course completion" in current page administration
And I set the field "id_overall_aggregation" to "2"
And I click on "Condition: Activity completion" "link"
And I set the field "Assignment - Test assignment name" to "1"
And I set the field "Chat - Music history" to "1"
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "Badges > Add a new badge" in current page administration
@@ -250,8 +257,7 @@ Feature: Award badges
And I follow "Profile" in the user menu
And I click on "Course 1" "link" in the "region-main" "region"
Then I should not see "badges"
And I am on "Course 1" course homepage
And I toggle the manual completion state of "Test assignment name"
When I am on the "Music history" "chat activity" page
And I log out
# Completion cron won't mark the whole course completed unless the
# individual criteria was marked completed more than a second ago. So
@@ -262,6 +268,7 @@ Feature: Award badges
# The student should now see their badge.
And I log in as "student1"
And I follow "Profile" in the user menu
And I click on "Course 1" "link" in the "region-main" "region"
Then I should see "Course Badge"
@javascript
@@ -32,18 +32,15 @@ Feature: The activity results block displays student scores
And the following "activities" exist:
| activity | name | content | course | section | idnumber |
| page | Test page name | This is a page | C1 | 1 | page1 |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment 1 | student1 | 90.00 |
| Test assignment 1 | student2 | 80.00 |
| Test assignment 1 | student3 | 70.00 |
| Test assignment 1 | student4 | 60.00 |
| Test assignment 1 | student5 | 50.00 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I should see "Test page name"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment 1"
And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment 1"
And I give the grade "70.00" to the user "Student 3" for the grade item "Test assignment 1"
And I give the grade "60.00" to the user "Student 4" for the grade item "Test assignment 1"
And I give the grade "50.00" to the user "Student 5" for the grade item "Test assignment 1"
And I press "Save changes"
And I am on "Course 1" course homepage
Scenario: Configure the block on a non-graded activity to show 3 high scores
Given I follow "Test page name"
@@ -27,17 +27,15 @@ Feature: The activity results block displays student high scores
And the following "activities" exist:
| activity | name | intro | course | section | idnumber | assignsubmission_file_enabled |
| assign | Test assignment | Offline text | C1 | 1 | assign1 | 0 |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment | student1 | 90.00 |
| Test assignment | student2 | 80.00 |
| Test assignment | student3 | 70.00 |
| Test assignment | student4 | 60.00 |
| Test assignment | student5 | 50.00 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment"
And I give the grade "70.00" to the user "Student 3" for the grade item "Test assignment"
And I give the grade "60.00" to the user "Student 4" for the grade item "Test assignment"
And I give the grade "50.00" to the user "Student 5" for the grade item "Test assignment"
And I press "Save changes"
And I am on "Course 1" course homepage
Scenario: Configure the block on the course page to show 0 high scores
Given I add the "Activity results" block
@@ -31,23 +31,15 @@ Feature: The activity results block displays students high scores in group as sc
| name | Test assignment |
| intro | Offline text |
| assignsubmission_file_enabled | 0 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Scales" in the course gradebook
And I press "Add a new scale"
And I set the following fields to these values:
| Name | My Scale |
| Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I press "Save changes"
And I am on "Course 1" course homepage
And I follow "Test assignment"
And I navigate to "Edit settings" in current page administration
And the following "scales" exist:
| name | scale |
| My Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I am on the "Test assignment" "assign activity editing" page logged in as teacher1
And I set the following fields to these values:
| id_grade_modgrade_type | Scale |
| id_grade_modgrade_scale | My Scale |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page
And I turn editing mode on
And I give the grade "Excellent!" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "Very good" to the user "Student 2" for the grade item "Test assignment"
@@ -44,25 +44,17 @@ Feature: The activity results block displays student in group high scores as sca
And the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| assign | Test assignment | Offline text | C1 | 1 | assign1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "Scales" in the course gradebook
And I press "Add a new scale"
And I set the following fields to these values:
| Name | My Scale |
| Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I press "Save changes"
And I am on "Course 1" course homepage
And I follow "Test assignment"
And I navigate to "Edit settings" in current page administration
And the following "scales" exist:
| name | scale |
| My Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I am on the "Test assignment" "assign activity editing" page logged in as teacher1
And I set the following fields to these values:
| assignsubmission_file_enabled | 0 |
| id_grade_modgrade_type | Scale |
| id_grade_modgrade_scale | My Scale |
| Group mode | Separate groups |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page
And I turn editing mode on
And I give the grade "Excellent!" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "Very good" to the user "Student 2" for the grade item "Test assignment"
@@ -71,7 +63,7 @@ Feature: The activity results block displays student in group high scores as sca
And I give the grade "Good" to the user "Student 5" for the grade item "Test assignment"
And I give the grade "Average" to the user "Student 6" for the grade item "Test assignment"
And I press "Save changes"
And I am on "Course 1" course homepage
And I am on "Course 1" course homepage with editing mode on
Scenario: Try to configure the block on the course page to show 1 high score
Given I add the "Activity results" block
@@ -84,9 +76,7 @@ Feature: The activity results block displays student in group high scores as sca
And I press "Save changes"
Then I should see "Group 1" in the "Activity results" "block"
And I should see "Excellent!" in the "Activity results" "block"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "Student 1" in the "Activity results" "block"
And I should see "Excellent!" in the "Activity results" "block"
@@ -105,9 +95,7 @@ Feature: The activity results block displays student in group high scores as sca
And I should see "Very good" in the "Activity results" "block"
And I should see "Group 3" in the "Activity results" "block"
And I should see "Good" in the "Activity results" "block"
And I log out
And I log in as "student3"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student3
And I should see "Student 3" in the "Activity results" "block"
And I should see "Very good" in the "Activity results" "block"
And I should see "Student 4" in the "Activity results" "block"
@@ -128,10 +116,8 @@ Feature: The activity results block displays student in group high scores as sca
And I should see "Excellent!" in the "Activity results" "block"
And I should see "Very good" in the "Activity results" "block"
And I should see "Good" in the "Activity results" "block"
And I log out
# Students cannot see user identity fields.
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "User" in the "Activity results" "block"
And I should not see "User S1" in the "Activity results" "block"
And I should see "Excellent!" in the "Activity results" "block"
@@ -151,9 +137,7 @@ Feature: The activity results block displays student in group high scores as sca
And I should see "Excellent!" in the "Activity results" "block"
And I should see "Very good" in the "Activity results" "block"
And I should see "Good" in the "Activity results" "block"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "User" in the "Activity results" "block"
And I should see "Excellent!" in the "Activity results" "block"
And I should see "Very good" in the "Activity results" "block"
@@ -46,22 +46,19 @@ Feature: The activity results block displays student in separate groups scores
| course | C1 |
| idnumber | 0001 |
| name | Test assignment |
| intro | Offline text |
| section | 1 |
| assignsubmission_file_enabled | 0 |
| groupmode | 1 |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment | student1 | 100.00 |
| Test assignment | student2 | 90.00 |
| Test assignment | student3 | 90.00 |
| Test assignment | student4 | 80.00 |
| Test assignment | student5 | 80.00 |
| Test assignment | student6 | 70.00 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment"
And I give the grade "90.00" to the user "Student 3" for the grade item "Test assignment"
And I give the grade "80.00" to the user "Student 4" for the grade item "Test assignment"
And I give the grade "80.00" to the user "Student 5" for the grade item "Test assignment"
And I give the grade "70.00" to the user "Student 6" for the grade item "Test assignment"
And I press "Save changes"
And I am on "Course 1" course homepage
Scenario: Configure the block on the course page to show 1 high score
Given I add the "Activity results" block
@@ -89,9 +86,7 @@ Feature: The activity results block displays student in separate groups scores
And I press "Save changes"
Then I should see "Group 1" in the "Activity results" "block"
And I should see "95.00/100.00" in the "Activity results" "block"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "Student 1" in the "Activity results" "block"
And I should see "100.00/100.00" in the "Activity results" "block"
@@ -107,9 +102,7 @@ Feature: The activity results block displays student in separate groups scores
And I press "Save changes"
Then I should see "Group 1" in the "Activity results" "block"
And I should see "95.00" in the "Activity results" "block"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "Student 1" in the "Activity results" "block"
And I should see "100.00" in the "Activity results" "block"
@@ -130,9 +123,7 @@ Feature: The activity results block displays student in separate groups scores
And I should see "85%" in the "Activity results" "block"
And I should see "Group 3" in the "Activity results" "block"
And I should see "75%" in the "Activity results" "block"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "Student 1" in the "Activity results" "block"
And I should see "100%" in the "Activity results" "block"
And I should see "Student 2" in the "Activity results" "block"
@@ -154,9 +145,7 @@ Feature: The activity results block displays student in separate groups scores
And I should see "85.00/100.00" in the "Activity results" "block"
And I should see "Group 3" in the "Activity results" "block"
And I should see "75.00/100.00" in the "Activity results" "block"
And I log out
And I log in as "student3"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student3
And I should see "Student 3" in the "Activity results" "block"
And I should see "90.00/100.00" in the "Activity results" "block"
And I should see "Student 4" in the "Activity results" "block"
@@ -178,9 +167,7 @@ Feature: The activity results block displays student in separate groups scores
And I should see "85.00" in the "Activity results" "block"
And I should see "Group 3" in the "Activity results" "block"
And I should see "75.00" in the "Activity results" "block"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "Student 1" in the "Activity results" "block"
And I should see "100.00" in the "Activity results" "block"
And I should see "Student 2" in the "Activity results" "block"
@@ -202,10 +189,8 @@ Feature: The activity results block displays student in separate groups scores
And I should see "95.00%" in the "Activity results" "block"
And I should see "85.00%" in the "Activity results" "block"
And I should see "75.00%" in the "Activity results" "block"
And I log out
# Students cannot see user identity fields.
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "User" in the "Activity results" "block"
And I should not see "User S1" in the "Activity results" "block"
And I should see "100.00%" in the "Activity results" "block"
@@ -226,9 +211,7 @@ Feature: The activity results block displays student in separate groups scores
And I should see "95.00%" in the "Activity results" "block"
And I should see "85.00%" in the "Activity results" "block"
And I should see "75.00%" in the "Activity results" "block"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "User" in the "Activity results" "block"
And I should see "100.00%" in the "Activity results" "block"
And I should see "90.00%" in the "Activity results" "block"
@@ -42,26 +42,18 @@ Feature: The activity results block displays student in visible groups scores
| student5 | G3 |
| student6 | G3 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section | assignsubmission_file_enabled |
| assign | Test assignment | Test assignment | C1 | assign1 | 1 | 0 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test assignment"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Group mode | Visible groups |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
| activity | name | course | idnumber | assignsubmission_file_enabled | groupmode |
| assign | Test assignment | C1 | assign1 | 0 | 2 |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment | student1 | 100.00 |
| Test assignment | student2 | 90.00 |
| Test assignment | student3 | 90.00 |
| Test assignment | student4 | 80.00 |
| Test assignment | student5 | 80.00 |
| Test assignment | student6 | 70.00 |
And I am on the "Course 1" course page logged in as teacher1
And I turn editing mode on
And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment"
And I give the grade "90.00" to the user "Student 3" for the grade item "Test assignment"
And I give the grade "80.00" to the user "Student 4" for the grade item "Test assignment"
And I give the grade "80.00" to the user "Student 5" for the grade item "Test assignment"
And I give the grade "70.00" to the user "Student 6" for the grade item "Test assignment"
And I press "Save changes"
And I am on "Course 1" course homepage
Scenario: Configure the block on the course page to show 1 high score
Given I add the "Activity results" block
@@ -29,20 +29,16 @@ Feature: The activity results block displays student low scores
| course | C1 |
| idnumber | 0001 |
| name | Test assignment |
| intro | Offline text |
| section | 1 |
| assignsubmission_file_enabled | 0 |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment | student1 | 90.00 |
| Test assignment | student2 | 80.00 |
| Test assignment | student3 | 70.00 |
| Test assignment | student4 | 60.00 |
| Test assignment | student5 | 50.00 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment"
And I give the grade "70.00" to the user "Student 3" for the grade item "Test assignment"
And I give the grade "60.00" to the user "Student 4" for the grade item "Test assignment"
And I give the grade "50.00" to the user "Student 5" for the grade item "Test assignment"
And I press "Save changes"
And I am on "Course 1" course homepage
Scenario: Configure the block on the course page to show 1 low score
Given I add the "Activity results" block
@@ -32,23 +32,15 @@ Feature: The activity results block displays student low scores as scales
| idnumber | 0001 |
| section | 1 |
| assignsubmission_file_enabled | 0 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Scales" in the course gradebook
And I press "Add a new scale"
And I set the following fields to these values:
| Name | My Scale |
| Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I press "Save changes"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test assignment"
And I navigate to "Edit settings" in current page administration
And the following "scales" exist:
| name | scale |
| My Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I am on the "Test assignment" "assign activity editing" page logged in as teacher1
And I set the following fields to these values:
| id_grade_modgrade_type | Scale |
| id_grade_modgrade_scale | My Scale |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page
And I turn editing mode on
And I give the grade "Excellent!" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "Very good" to the user "Student 2" for the grade item "Test assignment"
@@ -56,7 +48,7 @@ Feature: The activity results block displays student low scores as scales
And I give the grade "Average" to the user "Student 4" for the grade item "Test assignment"
And I give the grade "Not good enough" to the user "Student 5" for the grade item "Test assignment"
And I press "Save changes"
And I am on "Course 1" course homepage
And I am on "Course 1" course homepage with editing mode on
Scenario: Configure the block on the course page to show 1 low score
Given I add the "Activity results" block
@@ -49,23 +49,16 @@ Feature: The activity results block displays students in groups low scores as sc
| description | Offline text |
| assignsubmission_file_enabled | 0 |
| groupmode | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Scales" in the course gradebook
And I press "Add a new scale"
And I set the following fields to these values:
| Name | My Scale |
| Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I press "Save changes"
And I am on "Course 1" course homepage
And I follow "Test assignment"
And I navigate to "Edit settings" in current page administration
And the following "scales" exist:
| name | scale |
| My Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I change window size to "large"
And I am on the "Test assignment" "assign activity editing" page logged in as teacher1
And I set the following fields to these values:
| id_grade_modgrade_type | Scale |
| id_grade_modgrade_scale | My Scale |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page
And I turn editing mode on
And I give the grade "Excellent!" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "Very good" to the user "Student 2" for the grade item "Test assignment"
@@ -87,9 +80,7 @@ Feature: The activity results block displays students in groups low scores as sc
And I press "Save changes"
Then I should see "Group 3" in the "Activity results" "block"
And I should see "Good" in the "Activity results" "block"
And I log out
And I log in as "student5"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student5
And I should see "Student 6" in the "Activity results" "block"
And I should see "Average" in the "Activity results" "block"
@@ -106,9 +97,7 @@ Feature: The activity results block displays students in groups low scores as sc
And I should see "Very good" in the "Activity results" "block"
And I should see "Group 3" in the "Activity results" "block"
And I should see "Good" in the "Activity results" "block"
And I log out
And I log in as "student3"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student3
And I should see "Student 3" in the "Activity results" "block"
And I should see "Very good" in the "Activity results" "block"
And I should see "Student 4" in the "Activity results" "block"
@@ -128,10 +117,8 @@ Feature: The activity results block displays students in groups low scores as sc
Then I should see "Group" in the "Activity results" "block"
And I should see "Very good" in the "Activity results" "block"
And I should see "Good" in the "Activity results" "block"
And I log out
# Students cannot see user identity fields.
And I log in as "student5"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student5
And I should see "User" in the "Activity results" "block"
And I should not see "User S5" in the "Activity results" "block"
And I should see "Good" in the "Activity results" "block"
@@ -150,9 +137,7 @@ Feature: The activity results block displays students in groups low scores as sc
Then I should see "Group" in the "Activity results" "block"
And I should see "Very good" in the "Activity results" "block"
And I should see "Good" in the "Activity results" "block"
And I log out
And I log in as "student5"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student5
And I should see "User" in the "Activity results" "block"
And I should see "Good" in the "Activity results" "block"
And I should see "Average" in the "Activity results" "block"
@@ -42,20 +42,18 @@ Feature: The activity results block displays students in separate groups scores
| student5 | G3 |
| student6 | G3 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_file_enabled | groupmode |
| assign | C1 | a1 | Test assignment | Offline text | 0 | 1 |
| activity | course | idnumber | name | assignsubmission_file_enabled | groupmode |
| assign | C1 | a1 | Test assignment | 0 | 1 |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment | student1 | 100.00 |
| Test assignment | student2 | 90.00 |
| Test assignment | student3 | 90.00 |
| Test assignment | student4 | 80.00 |
| Test assignment | student5 | 80.00 |
| Test assignment | student6 | 70.00 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment"
And I give the grade "90.00" to the user "Student 3" for the grade item "Test assignment"
And I give the grade "80.00" to the user "Student 4" for the grade item "Test assignment"
And I give the grade "80.00" to the user "Student 5" for the grade item "Test assignment"
And I give the grade "70.00" to the user "Student 6" for the grade item "Test assignment"
And I press "Save changes"
And I am on "Course 1" course homepage
Scenario: Configure the block on the course page to show 1 low score
Given I add the "Activity results" block
@@ -83,9 +81,7 @@ Feature: The activity results block displays students in separate groups scores
And I press "Save changes"
Then I should see "Group 3" in the "Activity results" "block"
And I should see "75.00/100.00" in the "Activity results" "block"
And I log out
And I log in as "student5"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student5
And I should see "Student 6" in the "Activity results" "block"
And I should see "70.00/100.00" in the "Activity results" "block"
@@ -101,9 +97,7 @@ Feature: The activity results block displays students in separate groups scores
And I press "Save changes"
Then I should see "Group 3" in the "Activity results" "block"
And I should see "75.00" in the "Activity results" "block"
And I log out
And I log in as "student5"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student5
And I should see "Student 6" in the "Activity results" "block"
And I should see "70.00" in the "Activity results" "block"
@@ -122,9 +116,7 @@ Feature: The activity results block displays students in separate groups scores
And I should see "85%" in the "Activity results" "block"
And I should see "Group 3" in the "Activity results" "block"
And I should see "75%" in the "Activity results" "block"
And I log out
And I log in as "student5"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student5
And I should see "Student 6" in the "Activity results" "block"
And I should see "70%" in the "Activity results" "block"
And I should see "Student 5" in the "Activity results" "block"
@@ -144,9 +136,7 @@ Feature: The activity results block displays students in separate groups scores
And I should see "85.00/100.00" in the "Activity results" "block"
And I should see "Group 3" in the "Activity results" "block"
And I should see "75.00/100.00" in the "Activity results" "block"
And I log out
And I log in as "student3"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student3
And I should see "Student 3" in the "Activity results" "block"
And I should see "90.00/100.00" in the "Activity results" "block"
And I should see "Student 4" in the "Activity results" "block"
@@ -166,9 +156,7 @@ Feature: The activity results block displays students in separate groups scores
And I should see "85.00" in the "Activity results" "block"
And I should see "Group 3" in the "Activity results" "block"
And I should see "75.00" in the "Activity results" "block"
And I log out
And I log in as "student5"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student5
And I should see "Student 5" in the "Activity results" "block"
And I should see "80.00" in the "Activity results" "block"
And I should see "Student 6" in the "Activity results" "block"
@@ -189,10 +177,8 @@ Feature: The activity results block displays students in separate groups scores
Then I should see "Group" in the "Activity results" "block"
And I should see "85.00%" in the "Activity results" "block"
And I should see "75.00%" in the "Activity results" "block"
And I log out
# Students cannot see user identity fields.
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "User" in the "Activity results" "block"
And I should not see "User S1" in the "Activity results" "block"
And I should see "100.00%" in the "Activity results" "block"
@@ -212,9 +198,7 @@ Feature: The activity results block displays students in separate groups scores
Then I should see "Group" in the "Activity results" "block"
And I should see "85.00%" in the "Activity results" "block"
And I should see "75.00%" in the "Activity results" "block"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "User" in the "Activity results" "block"
And I should see "100.00%" in the "Activity results" "block"
And I should see "90.00%" in the "Activity results" "block"
@@ -46,22 +46,18 @@ Feature: The activity results block displays student in visible groups low score
| course | C1 |
| idnumber | 0001 |
| name | Test assignment |
| intro | Offline text |
| section | 1 |
| assignsubmission_file_enabled | 0 |
| groupmode | 2 |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment | student1 | 100.00 |
| Test assignment | student2 | 90.00 |
| Test assignment | student3 | 90.00 |
| Test assignment | student4 | 80.00 |
| Test assignment | student5 | 80.00 |
| Test assignment | student6 | 70.00 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment"
And I give the grade "90.00" to the user "Student 3" for the grade item "Test assignment"
And I give the grade "80.00" to the user "Student 4" for the grade item "Test assignment"
And I give the grade "80.00" to the user "Student 5" for the grade item "Test assignment"
And I give the grade "70.00" to the user "Student 6" for the grade item "Test assignment"
And I press "Save changes"
And I am on "Course 1" course homepage
Scenario: Configure the block on the course page to show 1 low score
Given I add the "Activity results" block
@@ -87,9 +83,7 @@ Feature: The activity results block displays student in visible groups low score
| id_config_nameformat | Display full names |
| id_config_usegroups | Yes |
And I press "Save changes"
And I log out
Then I log in as "student1"
And I am on "Course 1" course homepage
Then I am on the "Course 1" course page logged in as student1
And I should see "Group 3" in the "Activity results" "block"
And I should see "75.00/100.00" in the "Activity results" "block"
@@ -103,9 +97,7 @@ Feature: The activity results block displays student in visible groups low score
| id_config_nameformat | Display full names |
| id_config_usegroups | Yes |
And I press "Save changes"
And I log out
Then I log in as "student1"
And I am on "Course 1" course homepage
Then I am on the "Course 1" course page logged in as student1
And I should see "Group 3" in the "Activity results" "block"
And I should see "75.00" in the "Activity results" "block"
@@ -124,9 +116,7 @@ Feature: The activity results block displays student in visible groups low score
And I should see "85%" in the "Activity results" "block"
And I should see "Group 3" in the "Activity results" "block"
And I should see "75%" in the "Activity results" "block"
And I log out
And I log in as "student5"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student5
Then I should see "Group 2" in the "Activity results" "block"
And I should see "85%" in the "Activity results" "block"
And I should see "Group 3" in the "Activity results" "block"
@@ -142,9 +132,7 @@ Feature: The activity results block displays student in visible groups low score
| id_config_nameformat | Display full names |
| id_config_usegroups | Yes |
And I press "Save changes"
And I log out
Then I log in as "student1"
And I am on "Course 1" course homepage
Then I am on the "Course 1" course page logged in as student1
And I should see "Group 2" in the "Activity results" "block"
And I should see "85.00/100.00" in the "Activity results" "block"
And I should see "Group 3" in the "Activity results" "block"
@@ -160,9 +148,7 @@ Feature: The activity results block displays student in visible groups low score
| id_config_nameformat | Display full names |
| id_config_usegroups | Yes |
And I press "Save changes"
And I log out
Then I log in as "student1"
And I am on "Course 1" course homepage
Then I am on the "Course 1" course page logged in as student1
And I should see "Group 2" in the "Activity results" "block"
And I should see "85.00" in the "Activity results" "block"
And I should see "Group 3" in the "Activity results" "block"
@@ -180,9 +166,7 @@ Feature: The activity results block displays student in visible groups low score
| id_config_nameformat | Display only ID numbers |
| id_config_usegroups | Yes |
And I press "Save changes"
And I log out
Then I log in as "student1"
And I am on "Course 1" course homepage
Then I am on the "Course 1" course page logged in as student1
And I should see "Group" in the "Activity results" "block"
And I should see "85.00%" in the "Activity results" "block"
And I should see "75.00%" in the "Activity results" "block"
@@ -197,9 +181,7 @@ Feature: The activity results block displays student in visible groups low score
| id_config_nameformat | Anonymous results |
| id_config_usegroups | Yes |
And I press "Save changes"
And I log out
Then I log in as "student1"
And I am on "Course 1" course homepage
Then I am on the "Course 1" course page logged in as student1
And I should see "Group" in the "Activity results" "block"
And I should see "85.00%" in the "Activity results" "block"
And I should see "75.00%" in the "Activity results" "block"
@@ -18,17 +18,12 @@ Feature: Latest announcements block displays the course latest news
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| news_items | Course | C1 | course-view-* | side-pre |
And I am on the "Course 1" Course page logged in as teacher1
When I add a new topic to "Announcements" forum with:
| Subject | Discussion One |
| Message | Not important |
And I add a new topic to "Announcements" forum with:
| Subject | Discussion Two |
| Message | Not important |
And I add a new topic to "Announcements" forum with:
| Subject | Discussion Three |
| Message | Not important |
And I am on "Course 1" course homepage
And the following "mod_forum > discussions" exist:
| user | forum | name | message |
| teacher1 | Announcements | Discussion One | Not important |
| teacher1 | Announcements | Discussion Two | Not important |
| teacher1 | Announcements | Discussion Three | Not important |
When I am on the "Course 1" Course page logged in as teacher1
Then I should see "Discussion One" in the "Latest announcements" "block"
And I should see "Discussion Two" in the "Latest announcements" "block"
And I should see "Discussion Three" in the "Latest announcements" "block"
@@ -23,6 +23,9 @@ Feature: The search forums block allows users to search for forum posts on cours
And I am on the "Course 1" "course editing" page logged in as teacher1
And I set the field "id_newsitems" to "1"
And I press "Save and display"
And the following "mod_forum > discussions" exist:
| user | forum | name | message |
| teacher1 | Announcements | My subject | My message |
Scenario: Use the search forum block in a course without any forum posts
Given I am on the "Course 1" course page logged in as student1
@@ -31,12 +34,7 @@ Feature: The search forums block allows users to search for forum posts on cours
Then I should see "No posts"
Scenario: Use the search forum block in a course with a hidden forum and search for posts
Given I add a new topic to "Announcements" forum with:
| Subject | My subject |
| Message | My message |
And I am on "Course 1" course homepage with editing mode on
And I follow "Announcements"
And I navigate to "Edit settings" in current page administration
Given I am on the "Announcements" "forum activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the field "id_visible" to "0"
And I press "Save and return to course"
@@ -47,10 +45,7 @@ Feature: The search forums block allows users to search for forum posts on cours
Then I should see "No posts"
Scenario: Use the search forum block in a course and search for posts
Given I add a new topic to "Announcements" forum with:
| Subject | My subject |
| Message | My message |
When I am on the "Course 1" course page logged in as student1
Given I am on the "Course 1" course page logged in as student1
And "Search forums" "block" should exist
And I set the field "Search" to "message"
And I press "Search"
+1 -1
View File
@@ -1,3 +1,3 @@
function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}define("core_course/manual_completion_toggle",["exports","core/templates","core/notification","core_course/repository","core_course/events"],(function(_exports,_templates,_notification,_repository,CourseEvents){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_templates=_interopRequireDefault(_templates),_notification=_interopRequireDefault(_notification),CourseEvents=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}(CourseEvents);var SELECTORS_MANUAL_TOGGLE="button[data-action=toggle-manual-completion]",TOGGLE_TYPES_TOGGLE_MARK_DONE="manual:mark-done",registered=!1;_exports.init=function(){registered||(document.addEventListener("click",(function(e){var toggleButton=e.target.closest(SELECTORS_MANUAL_TOGGLE);toggleButton&&(e.preventDefault(),toggleManualCompletionState(toggleButton).catch(_notification.default.exception))})),registered=!0)};var fn,_ref,toggleManualCompletionState=(fn=regeneratorRuntime.mark((function _callee(toggleButton){var originalInnerHtml,toggleType,cmid,activityname,completed,loadingHtml,templateContext,renderObject,replacedNode,newToggleButton,withAvailability,toggledEvent;return regeneratorRuntime.wrap((function(_context){for(;;)switch(_context.prev=_context.next){case 0:return originalInnerHtml=toggleButton.innerHTML,toggleButton.setAttribute("disabled","disabled"),toggleType=toggleButton.getAttribute("data-toggletype"),cmid=toggleButton.getAttribute("data-cmid"),activityname=toggleButton.getAttribute("data-activityname"),completed=toggleType===TOGGLE_TYPES_TOGGLE_MARK_DONE,_context.next=8,_templates.default.render("core/loading",{});case 8:return loadingHtml=_context.sent,_context.next=11,_templates.default.replaceNodeContents(toggleButton,loadingHtml,"");case 11:return _context.prev=11,_context.next=14,(0,_repository.toggleManualCompletion)(cmid,completed);case 14:return templateContext={cmid:cmid,activityname:activityname,overallcomplete:completed,overallincomplete:!completed,istrackeduser:!0},_context.next=17,_templates.default.renderForPromise("core_course/completion_manual",templateContext);case 17:return renderObject=_context.sent,_context.next=20,_templates.default.replaceNode(toggleButton,renderObject.html,renderObject.js);case 20:replacedNode=_context.sent,newToggleButton=replacedNode.pop(),withAvailability=toggleButton.getAttribute("data-withavailability"),toggledEvent=new CustomEvent(CourseEvents.manualCompletionToggled,{bubbles:!0,detail:{cmid:cmid,activityname:activityname,completed:completed,withAvailability:withAvailability}}),newToggleButton.dispatchEvent(toggledEvent),_context.next=32;break;case 27:_context.prev=27,_context.t0=_context.catch(11),toggleButton.removeAttribute("disabled"),toggleButton.innerHTML=originalInnerHtml,_notification.default.exception(_context.t0);case 32:case"end":return _context.stop()}}),_callee,null,[[11,27]])})),_ref=function(){var self=this,args=arguments;return new Promise((function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)}))},function(_x){return _ref.apply(this,arguments)})}));
function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}define("core_course/manual_completion_toggle",["exports","core/templates","core/notification","core_course/repository","core_course/events","core/pending"],(function(_exports,_templates,_notification,_repository,CourseEvents,_pending){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_templates=_interopRequireDefault(_templates),_notification=_interopRequireDefault(_notification),CourseEvents=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}(CourseEvents),_pending=_interopRequireDefault(_pending);var SELECTORS_MANUAL_TOGGLE="button[data-action=toggle-manual-completion]",TOGGLE_TYPES_TOGGLE_MARK_DONE="manual:mark-done",registered=!1;_exports.init=function(){registered||(document.addEventListener("click",(function(e){var toggleButton=e.target.closest(SELECTORS_MANUAL_TOGGLE);toggleButton&&(e.preventDefault(),toggleManualCompletionState(toggleButton).catch(_notification.default.exception))})),registered=!0)};var fn,_ref,toggleManualCompletionState=(fn=regeneratorRuntime.mark((function _callee(toggleButton){var pendingPromise,originalInnerHtml,toggleType,cmid,activityname,completed,templateContext,renderObject,replacedNode,newToggleButton,withAvailability,toggledEvent;return regeneratorRuntime.wrap((function(_context){for(;;)switch(_context.prev=_context.next){case 0:return pendingPromise=new _pending.default("core_course:toggleManualCompletionState"),originalInnerHtml=toggleButton.innerHTML,toggleButton.setAttribute("disabled","disabled"),toggleType=toggleButton.getAttribute("data-toggletype"),cmid=toggleButton.getAttribute("data-cmid"),activityname=toggleButton.getAttribute("data-activityname"),completed=toggleType===TOGGLE_TYPES_TOGGLE_MARK_DONE,_templates.default.renderForPromise("core/loading",{}).then((function(loadingHtml){_templates.default.replaceNodeContents(toggleButton,loadingHtml,"")})).catch((function(){})),_context.prev=8,_context.next=11,(0,_repository.toggleManualCompletion)(cmid,completed);case 11:return templateContext={cmid:cmid,activityname:activityname,overallcomplete:completed,overallincomplete:!completed,istrackeduser:!0},_context.next=14,_templates.default.renderForPromise("core_course/completion_manual",templateContext);case 14:return renderObject=_context.sent,_context.next=17,_templates.default.replaceNode(toggleButton,renderObject.html,renderObject.js);case 17:replacedNode=_context.sent,newToggleButton=replacedNode.pop(),withAvailability=toggleButton.getAttribute("data-withavailability"),toggledEvent=new CustomEvent(CourseEvents.manualCompletionToggled,{bubbles:!0,detail:{cmid:cmid,activityname:activityname,completed:completed,withAvailability:withAvailability}}),newToggleButton.dispatchEvent(toggledEvent),_context.next=29;break;case 24:_context.prev=24,_context.t0=_context.catch(8),toggleButton.removeAttribute("disabled"),toggleButton.innerHTML=originalInnerHtml,_notification.default.exception(_context.t0);case 29:pendingPromise.resolve();case 30:case"end":return _context.stop()}}),_callee,null,[[8,24]])})),_ref=function(){var self=this,args=arguments;return new Promise((function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)}))},function(_x){return _ref.apply(this,arguments)})}));
//# sourceMappingURL=manual_completion_toggle.min.js.map
File diff suppressed because one or more lines are too long
+8 -2
View File
@@ -26,6 +26,7 @@ import Templates from 'core/templates';
import Notification from 'core/notification';
import {toggleManualCompletion} from 'core_course/repository';
import * as CourseEvents from 'core_course/events';
import Pending from 'core/pending';
/**
* Selectors in the manual completion template.
@@ -77,6 +78,7 @@ export const init = () => {
* @returns {Promise<void>}
*/
const toggleManualCompletionState = async(toggleButton) => {
const pendingPromise = new Pending('core_course:toggleManualCompletionState');
// Make a copy of the original content of the button.
const originalInnerHtml = toggleButton.innerHTML;
@@ -91,8 +93,11 @@ const toggleManualCompletionState = async(toggleButton) => {
const completed = toggleType === TOGGLE_TYPES.TOGGLE_MARK_DONE;
// Replace the button contents with the loading icon.
const loadingHtml = await Templates.render('core/loading', {});
await Templates.replaceNodeContents(toggleButton, loadingHtml, '');
Templates.renderForPromise('core/loading', {})
.then((loadingHtml) => {
Templates.replaceNodeContents(toggleButton, loadingHtml, '');
return;
}).catch(() => {});
try {
// Call the webservice to update the manual completion status.
@@ -134,4 +139,5 @@ const toggleManualCompletionState = async(toggleButton) => {
// Show the exception.
Notification.exception(exception);
}
pendingPromise.resolve();
};
+13
View File
@@ -2144,6 +2144,19 @@ class core_course_external extends external_api {
self::validate_context($categorycontext);
require_capability('moodle/category:manage', $categorycontext);
// If the category parent is being changed, check for capability in the new parent category
if (isset($cat['parent']) && ($cat['parent'] !== $category->parent)) {
if ($cat['parent'] == 0) {
// Creating a top level category requires capability in the system context
$parentcontext = context_system::instance();
} else {
// Category context
$parentcontext = context_coursecat::instance($cat['parent']);
}
self::validate_context($parentcontext);
require_capability('moodle/category:manage', $parentcontext);
}
// this will throw an exception if descriptionformat is not valid
external_validate_format($cat['descriptionformat']);
@@ -0,0 +1,39 @@
@core @core_course
Feature: Delete activity and resource works correctly
As a teacher
I want to be able to delete an activity and resource
So that I can remove it from the course
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | course | name | intro |
| label | C1 | Label 1 | Label 1 |
| glossary | C1 | Glossary 1 | Glossary 1 |
@javascript
Scenario: Activity and resource can be deleted properly
Given I am on the "Course 1" course page logged in as teacher1
And I turn editing mode on
And I open "Label 1" actions menu
When I click on "Delete" "link" in the "Label 1" activity
And I click on "Yes" "button" in the "Confirm" "dialogue"
# Confirm that label is successfully deleted
Then I should not see "Label 1"
And I open "Glossary 1" actions menu
And I click on "Delete" "link" in the "Glossary 1" activity
And I click on "Yes" "button" in the "Confirm" "dialogue"
# Confirm that glossary is successfully deleted
And I should not see "Glossary 1"
# Reload the page and confirm that both the label and glossary are really deleted
And I reload the page
And I should not see "Label 1"
And I should not see "Glossary 1"
@@ -0,0 +1,71 @@
@core @core_course
Feature: Display activity and resource description
In order to display activity and resource description
As teacher
I should be able to enable "Display description on course page"
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
Scenario Outline: Display activity and resource descriptions
# Generate activity/resource with description
Given the following "activities" exist:
| activity | course | name | intro | showdescription |
| <acttype> | C1 | <actname> | <actname> intro | 1 |
When I am on the "Course 1" course page logged in as teacher1
# Confirm that activity name and description are displayed
Then I should see "<actname>" in the "region-main" "region"
And I should see "<actname> intro" in the "region-main" "region"
Examples:
| acttype | actname |
| assign | Assign 1 |
| book | Book 1 |
| chat | Chat 1 |
| data | Database 1 |
| feedback | Feedback 1 |
| forum | Forum 1 |
| label | Label 1 |
| lti | LTI 1 |
| page | Page 1 |
| quiz | Quiz 1 |
| resource | Resource 1 |
| imscp | IMSCP 1 |
| folder | Folder 1 |
| glossary | Glossary 1 |
| scorm | Scorm 1 |
| lesson | Lesson 1 |
| survey | Survey 1 |
| url | URL 1 |
| wiki | Wiki 1 |
| workshop | Workshop 1 |
Scenario: Display url activity description with pop-up display
# Generate url activity with description and popup appearance
Given the following "activities" exist:
| activity | course | name | intro | showdescription | display | popupwidth | popupheight |
| url | C1 | URL 1 | URL 1 intro | 1 | 6 | 620 | 450 |
When I am on the "Course 1" course page logged in as teacher1
# Confirm that activity name and description are displayed
Then I should see "URL 1" in the "region-main" "region"
And I should see "URL 1 intro" in the "region-main" "region"
Scenario: Display activity with image description
# Generate page activity with image embedded in description
Given the following "activities" exist:
| activity | course | name | intro | showdescription |
| page | C1 | Page 1 | Page 1 intro with image: <img src="http://download.moodle.org/unittest/test.jpg"> | 1 |
When I am on the "Course 1" course page logged in as teacher1
# Confirm that activity name and description are displayed
Then I should see "Page 1" in the "region-main" "region"
And I should see "Page 1 intro with image:" in the "region-main" "region"
# Confirm that image element exists
And "//img[contains(@src, 'http://download.moodle.org/unittest/test.jpg')]" "xpath_element" should exist in the "region-main" "region"
+38
View File
@@ -362,6 +362,44 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
core_course_external::update_categories($categories);
}
/**
* Test update_categories method for moving categories
*/
public function test_update_categories_moving() {
$this->resetAfterTest();
// Create data.
$categorya = self::getDataGenerator()->create_category([
'name' => 'CAT_A',
]);
$categoryasub = self::getDataGenerator()->create_category([
'name' => 'SUBCAT_A',
'parent' => $categorya->id
]);
$categoryb = self::getDataGenerator()->create_category([
'name' => 'CAT_B',
]);
// Create a new test user.
$testuser = self::getDataGenerator()->create_user();
$this->setUser($testuser);
// Set the capability for CAT_A only.
$contextcata = context_coursecat::instance($categorya->id);
$roleid = $this->assignUserCapability('moodle/category:manage', $contextcata->id);
// Then we move SUBCAT_A parent: CAT_A => CAT_B.
$categories = [
[
'id' => $categoryasub->id,
'parent' => $categoryb->id
]
];
$this->expectException('required_capability_exception');
core_course_external::update_categories($categories);
}
/**
* Test create_courses numsections
*/
+16 -5
View File
@@ -570,17 +570,28 @@ class course_enrolment_manager {
*/
public function search_users(string $search = '', bool $searchanywhere = false, int $page = 0, int $perpage = 25,
bool $returnexactcount = false) {
global $USER;
[$ufields, $joins, $params, $wherecondition] = $this->get_basic_search_conditions($search, $searchanywhere);
$groupmode = groups_get_course_groupmode($this->course);
if ($groupmode == SEPARATEGROUPS && !has_capability('moodle/site:accessallgroups', $this->context)) {
$groups = groups_get_all_groups($this->course->id, $USER->id, 0, 'g.id');
$groupids = array_column($groups, 'id');
} else {
$groupids = [];
}
[$enrolledsql, $enrolledparams] = get_enrolled_sql($this->context, '', $groupids);
$fields = 'SELECT ' . $ufields;
$countfields = 'SELECT COUNT(u.id)';
$sql = " FROM {user} u
$joins
JOIN {user_enrolments} ue ON ue.userid = u.id
JOIN {enrol} e ON ue.enrolid = e.id
WHERE $wherecondition
AND e.courseid = :courseid";
$params['courseid'] = $this->course->id;
JOIN ($enrolledsql) je ON je.id = u.id
WHERE $wherecondition";
$params = array_merge($params, $enrolledparams);
return $this->execute_search_queries($search, $fields, $countfields, $sql, $params, $page, $perpage, 0, $returnexactcount);
}
+56 -1
View File
@@ -16,6 +16,7 @@
namespace core_enrol;
use context_course;
use course_enrolment_manager;
/**
@@ -25,10 +26,11 @@ use course_enrolment_manager;
* @category test
* @copyright 2016 Ruslan Kabalin, Lancaster University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \course_enrolment_manager
*/
class course_enrolment_manager_test extends \advanced_testcase {
/**
* The course context used in tests.
* The course used in tests.
* @var stdClass
*/
private $course = null;
@@ -546,4 +548,57 @@ class course_enrolment_manager_test extends \advanced_testcase {
$this->assertArrayNotHasKey('totalusers', $users);
}
}
/**
* Test that search_users observes course group mode restrictions correctly
*/
public function test_search_users_course_groupmode(): void {
global $DB, $PAGE;
$this->resetAfterTest();
$teacher = $this->getDataGenerator()->create_and_enrol($this->course, 'teacher');
$this->getDataGenerator()->create_group_member(['groupid' => $this->groups['group1']->id, 'userid' => $teacher->id]);
$this->setUser($teacher);
$users = (new course_enrolment_manager($PAGE, $this->course))->search_users('', false, 0, 25, true);
$this->assertEqualsCanonicalizing([
$teacher->username,
$this->users['user0']->username,
$this->users['user1']->username,
$this->users['user21']->username,
$this->users['user22']->username,
$this->users['userall']->username,
$this->users['usertch']->username,
], array_column($users['users'], 'username'));
$this->assertEquals(7, $users['totalusers']);
// Switch course to separate groups.
$this->course->groupmode = SEPARATEGROUPS;
update_course($this->course);
$users = (new course_enrolment_manager($PAGE, $this->course))->search_users('', false, 0, 25, true);
$this->assertEqualsCanonicalizing([
$teacher->username,
$this->users['user1']->username,
$this->users['userall']->username,
], array_column($users['users'], 'username'));
$this->assertEquals(3, $users['totalusers']);
// Allow teacher to access all groups.
$roleid = $DB->get_field('role', 'id', ['shortname' => 'teacher']);
assign_capability('moodle/site:accessallgroups', CAP_ALLOW, $roleid, context_course::instance($this->course->id)->id);
$users = (new course_enrolment_manager($PAGE, $this->course))->search_users('', false, 0, 25, true);
$this->assertEqualsCanonicalizing([
$teacher->username,
$this->users['user0']->username,
$this->users['user1']->username,
$this->users['user21']->username,
$this->users['user22']->username,
$this->users['userall']->username,
$this->users['usertch']->username,
], array_column($users['users'], 'username'));
$this->assertEquals(7, $users['totalusers']);
}
}
+4 -6
View File
@@ -20,12 +20,10 @@ Feature: I need to export grades as text
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled |
| assign | C1 | a1 | Test assignment name | Submit your online text | 1 |
| assign | C1 | a2 | Test assignment name 2 | Submit your online text | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment name"
And I press "Save changes"
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment name | student1 | 80.00 |
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
@javascript
Scenario: Export grades as text
+7 -9
View File
@@ -19,15 +19,13 @@ Feature: I need to export grades as xml
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro |
| assign | C1 | a1 | Test assignment name | Submit something! |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment name"
And I give the grade "42.00" to the user "Student 2" for the grade item "Test assignment name"
And I press "Save changes"
| activity | course | idnumber | name |
| assign | C1 | a1 | Test assignment name |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment name | student1 | 80.00 |
| Test assignment name | student2 | 42.00 |
And I am on the "Course 1" course page logged in as teacher1
@javascript
Scenario: Export grades as XML
@@ -27,9 +27,9 @@
require_once(__DIR__ . '/../../../../../../lib/behat/behat_base.php');
use Behat\Gherkin\Node\TableNode as TableNode,
Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException,
Behat\Mink\Exception\ExpectationException as ExpectationException;
use Behat\Gherkin\Node\TableNode;
use Behat\Mink\Exception\ElementNotFoundException;
use Behat\Mink\Exception\ExpectationException;
/**
* Steps definitions to help with rubrics.
@@ -66,7 +66,6 @@ class behat_gradingform_rubric extends behat_base {
* @param TableNode $rubric
*/
public function i_define_the_following_rubric(TableNode $rubric) {
// Being a smart method is nothing good when we talk about step definitions, in
// this case we didn't have any other options as there are no labels no elements
// id we can point to without having to "calculate" them.
@@ -80,7 +79,6 @@ class behat_gradingform_rubric extends behat_base {
// Cleaning the current ones.
$deletebuttons = $this->find_all('css', "input[value='" . get_string('criteriondelete', 'gradingform_rubric') . "']");
if ($deletebuttons) {
// We should reverse the deletebuttons because otherwise once we delete
// the first one the DOM will change and the [X] one will not exist anymore.
$deletebuttons = array_reverse($deletebuttons, true);
@@ -132,7 +130,10 @@ class behat_gradingform_rubric extends behat_base {
}
// Add new criterion.
$addcriterionbutton->click();
$this->execute('behat_general::i_click_on', [
$addcriterionbutton,
'NodeElement',
]);
$criterionroot = 'rubric[criteria][NEWID' . ($criterionit + 1) . ']';
@@ -158,12 +159,14 @@ class behat_gradingform_rubric extends behat_base {
if ($this->running_javascript()) {
$deletelevel = $this->find_button($criterionroot . '[levels][NEWID' . $i . '][delete]');
$this->click_and_confirm($deletelevel);
} else {
// Only if the level exists.
$buttonname = $criterionroot . '[levels][NEWID' . $i . '][delete]';
if ($deletelevel = $this->getSession()->getPage()->findButton($buttonname)) {
$deletelevel->click();
$this->execute('behat_general::i_click_on', [
$deletelevel,
'NodeElement',
]);
}
}
}
@@ -171,7 +174,10 @@ class behat_gradingform_rubric extends behat_base {
// Adding levels if we don't have enough.
$addlevel = $this->find_button($criterionroot . '[levels][addlevel]');
for ($i = ($defaultnumberoflevels + 1); $i <= $nlevels; $i++) {
$addlevel->click();
$this->execute('behat_general::i_click_on', [
$addlevel,
'NodeElement',
]);
}
}
@@ -226,7 +232,6 @@ class behat_gradingform_rubric extends behat_base {
* @param string $criterionname
*/
public function i_replace_rubric_level_with($currentvalue, $value, $criterionname) {
$currentvalueliteral = behat_context_helper::escape($currentvalue);
$criterionliteral = behat_context_helper::escape($criterionname);
@@ -247,14 +252,15 @@ class behat_gradingform_rubric extends behat_base {
"/descendant::textarea[text()=$currentvalueliteral]";
if ($this->running_javascript()) {
$spansufix = "/ancestor::div[@class='level-wrapper']" .
"/descendant::div[@class='definition']" .
"/descendant::span[@class='textvalue']";
// Expanding the level input boxes.
$spannode = $this->find('xpath', $inputxpath . $spansufix . '|' . $textareaxpath . $spansufix);
$spannode->click();
$this->execute('behat_general::i_click_on', [
$inputxpath . $spansufix . '|' . $textareaxpath . $spansufix,
'xpath',
]);
$inputfield = $this->find('xpath', $inputxpath . '|' . $textareaxpath);
$inputfield->setValue($value);
@@ -263,7 +269,6 @@ class behat_gradingform_rubric extends behat_base {
$fieldnode = $this->find('xpath', $inputxpath . '|' . $textareaxpath);
$this->set_rubric_field_value($fieldnode->getAttribute('name'), $value);
}
}
/**
@@ -275,7 +280,6 @@ class behat_gradingform_rubric extends behat_base {
* @param TableNode $rubric
*/
public function i_grade_by_filling_the_rubric_with(TableNode $rubric) {
$criteria = $rubric->getRowsHash();
$stepusage = '"I grade by filling the rubric with:" step needs you to provide a table where each row is a criterion' .
@@ -288,7 +292,6 @@ class behat_gradingform_rubric extends behat_base {
// First element -> name, second -> points, third -> Remark.
foreach ($criteria as $name => $criterion) {
// We only expect the points and the remark, as the criterion name is $name.
if (count($criterion) !== 2) {
throw new ExpectationException($stepusage, $this->getSession());
@@ -349,7 +352,6 @@ class behat_gradingform_rubric extends behat_base {
* @return void
*/
public function the_level_with_points_was_previously_selected_for_the_rubric_criterion($points, $criterionname) {
$levelxpath = $this->get_criterion_xpath($criterionname) .
$this->get_level_xpath($points) .
"[contains(concat(' ', normalize-space(@class), ' '), ' currentchecked ')]";
@@ -378,7 +380,6 @@ class behat_gradingform_rubric extends behat_base {
* @return void
*/
public function the_level_with_points_is_selected_for_the_rubric_criterion($points, $criterionname) {
$levelxpath = $this->get_criterion_xpath($criterionname) .
$this->get_level_xpath($points);
@@ -409,7 +410,6 @@ class behat_gradingform_rubric extends behat_base {
* @return void
*/
public function the_level_with_points_is_not_selected_for_the_rubric_criterion($points, $criterionname) {
$levelxpath = $this->get_criterion_xpath($criterionname) .
$this->get_level_xpath($points);
@@ -437,12 +437,13 @@ class behat_gradingform_rubric extends behat_base {
* @return void
*/
protected function set_rubric_field_value($name, $value, $visible = false) {
// Fields are hidden by default.
if ($this->running_javascript() == true && $visible === false) {
$xpath = "//*[@name='$name']/following-sibling::*[contains(concat(' ', normalize-space(@class), ' '), ' plainvalue ')]";
$textnode = $this->find('xpath', $xpath);
$textnode->click();
$this->execute('behat_general::i_click_on', [
$xpath,
'xpath',
]);
}
// Set the value now.
@@ -457,19 +458,20 @@ class behat_gradingform_rubric extends behat_base {
* @return void
*/
protected function click_and_confirm($node) {
// Clicks to perform the action.
$node->click();
$this->execute('behat_general::i_click_on', [
$node,
'NodeElement',
]);
// Confirms the delete.
if ($this->running_javascript()) {
$confirmbutton = $this->get_node_in_container(
'button',
$this->execute('behat_general::i_click_on_in_the', [
get_string('yes'),
'button',
get_string('confirmation', 'admin'),
'dialogue',
get_string('confirmation', 'admin')
);
$confirmbutton->click();
]);
}
}
+4 -2
View File
@@ -67,8 +67,10 @@ class gradeimport_csv_renderer extends plugin_renderer_base {
$html = $this->output->heading(get_string('importpreview', 'grades'));
$table = new html_table();
$table->head = $header;
$table->data = $data;
$table->head = array_map('s', $header);
$table->data = array_map(static function($row) {
return array_map('s', $row);
}, $data);
$html .= html_writer::table($table);
return $html;
@@ -75,8 +75,7 @@ Feature: We can change what we are viewing on the grader report
And the following "role capability" exists:
| role | editingteacher |
| moodle/grade:viewhidden | prevent |
And I am on the "C1" "course" page logged in as "teacher1"
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
Then I should see "Test assignment name 1" in the "user-grades" "table"
And I should see "Test assignment name 2" in the "user-grades" "table"
And I should see "Manual grade"
@@ -22,22 +22,17 @@ Feature: A teacher checks the grade history report in a course
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | course | section | name | intro |
| assign | C1 | 1 | The greatest assignment ever | Write a behat test for Moodle - it's amazing |
| assign | C1 | 1 | Rewarding assignment | After writing your behat test go grab a beer! |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
| activity | course | name |
| assign | C1 | The greatest assignment ever |
| assign | C1 | Rewarding assignment |
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
And I give the grade "50.00" to the user "Student 1" for the grade item "The greatest assignment ever"
And I give the grade "60.00" to the user "Student 1" for the grade item "Rewarding assignment"
And I give the grade "50.00" to the user "Student 2" for the grade item "The greatest assignment ever"
And I give the grade "60.00" to the user "Student 2" for the grade item "Rewarding assignment"
And I press "Save changes"
And I log out
And I log in as "teacher2"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher2"
And I turn editing mode on
And I give the grade "70.00" to the user "Student 1" for the grade item "The greatest assignment ever"
And I give the grade "80.00" to the user "Student 1" for the grade item "Rewarding assignment"
@@ -1,4 +1,4 @@
@core @core_grades @gradereport_singleview
@core @core_grades @gradereport_singleview @javascript
Feature: We can use Single view
As a teacher
In order to view and edit grades
@@ -7,7 +7,7 @@ Feature: We can use Single view
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber | middlename | alternatename | firstnamephonetic | lastnamephonetic |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 | | fred | | |
@@ -53,11 +53,8 @@ Feature: We can use Single view
And the following config values are set as admin:
| fullnamedisplay | firstnamephonetic,lastnamephonetic |
| alternativefullnameformat | middlename, alternatename, firstname, lastname |
And I log in as "teacher1"
And I am on "Course 1" course homepage
Given I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
@javascript
Scenario: I can update grades, add feedback and exclude grades.
Given I navigate to "View > Single view" in the course gradebook
And I select "Student" from the "Select user..." singleselect
@@ -97,10 +94,7 @@ Feature: We can use Single view
And the following should exist in the "generaltable" table:
| First name (Alternate name) Surname | Grade |
| Ann, Jill, Grainne, Beauchamp | Very good |
And I log out
And I log in as "teacher2"
And I am on "Course 1" course homepage
Given I navigate to "View > Single view" in the course gradebook
And I am on the "Course 1" "grades > Single view > View" page logged in as "teacher2"
And I select "Student" from the "Select user..." singleselect
And the "Exclude for Test assignment one" "checkbox" should be disabled
And the "Override for Test assignment one" "checkbox" should be enabled
@@ -30,9 +30,7 @@ Feature: View the user report as the student will see it
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a5 | Test assignment five | Submit something! | 100 |
| assign | C1 | a6 | Test assignment six | Submit something! | 100 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
When I am on the "C1" "grades > gradebook setup" page logged in as "teacher1"
And I hide the grade item "Test assignment six"
And I hide the grade item "Sub category 2"
And I navigate to "View > Grader report" in the course gradebook
@@ -5,12 +5,10 @@ Feature: We can use the user report
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
Scenario: Verify we can view a user grade report with no users enrolled.
Given I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "View > User report" in the course gradebook
When I am on the "Course 1" "grades > User report > View" page logged in as "admin"
And I select "All users (0)" from the "Select all or one user" singleselect
Then I should see "There are no students enrolled in this course."
+12
View File
@@ -35,6 +35,8 @@ class behat_grades extends behat_base {
* | [report] view | Course name | The view page for the specified course and report |
* | gradebook setup | Course name | The gradebook setup page for the specified course |
* | course grade settings | Course name | The grade settings page |
* | outcomes | Course name | The grade outcomes page |
* | scales | Course name | The grade scales page |
*
* @param string $type identifies which type of page this is - for example "Grader > View"
* @param string $identifier identifies the particular page - for example "Course name"
@@ -86,6 +88,16 @@ class behat_grades extends behat_base {
"/grade/edit/settings/index.php",
['id' => $this->get_course_id($identifier)]
);
case 'outcomes':
return new moodle_url(
"/grade/edit/outcome/course.php",
['id' => $this->get_course_id($identifier)]
);
case 'scales':
return new moodle_url(
"/grade/edit/scale/index.php",
['id' => $this->get_course_id($identifier)]
);
default:
throw new \coding_exception(
"Unknown page type '$type' for page identifier '$identifier'"
+3 -7
View File
@@ -17,9 +17,7 @@ Feature: Site settings can be used to hide parts of the gradebook UI
And the following "activities" exist:
| activity | course | idnumber | name | intro |
| assign | C1 | assign1 | Assignment1 | Assignment 1 intro |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page logged in as "admin"
And I turn editing mode on
@javascript
@@ -29,8 +27,7 @@ Feature: Site settings can be used to hide parts of the gradebook UI
Then I navigate to "Grades > General settings" in site administration
And I set the field "Show minimum grade" to "0"
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page
And I click on "Edit assign Assignment1" "link"
And I should not see "Minimum grade"
@@ -50,6 +47,5 @@ Feature: Site settings can be used to hide parts of the gradebook UI
Then I navigate to "Grades > Grade category settings" in site administration
And I set the field "Allow category grades to be manually overridden" to "0"
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page
And "tr .course input[type='text']" "css_element" should not exist
+21 -32
View File
@@ -1,4 +1,4 @@
@core @core_grades
@core @core_grades @javascript
Feature: We can use calculated grade totals
In order to calculate grade totals
As an teacher
@@ -39,20 +39,18 @@ Feature: We can use calculated grade totals
And I log in as "admin"
And I set the following administration settings values:
| grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment one & | student1 | 60.00 |
| Test assignment two | student1 | 20.00 |
| Test assignment three | student1 | 40.00 |
| Test assignment five | student1 | 10.00 |
| Test assignment six | student1 | 5.00 |
| Test assignment eight | student1 | 10.00 |
| Test assignment nine | student1 | 5.00 |
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
And I change window size to "large"
And I give the grade "60.00" to the user "Student 1" for the grade item "Test assignment one &"
And I give the grade "20.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "40.00" to the user "Student 1" for the grade item "Test assignment three"
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment five"
And I give the grade "5.00" to the user "Student 1" for the grade item "Test assignment six"
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment eight"
And I give the grade "5.00" to the user "Student 1" for the grade item "Test assignment nine"
And I press "Save changes"
And I set the following settings for grade item "Test assignment two":
| Hidden | 1 |
And I set the following settings for grade item "Test assignment five":
@@ -241,6 +239,7 @@ Feature: We can use calculated grade totals
| Aggregation | Natural |
| Include outcomes in aggregation | 1 |
| Exclude empty grades | 0 |
And I change window size to "large"
And I navigate to "View > Grader report" in the course gradebook
And I give the grade "Excellent" to the user "Student 1" for the grade item "Test outcome item one"
And I press "Save changes"
@@ -254,22 +253,16 @@ Feature: We can use calculated grade totals
Then I should see "114.82 (18.27 %)" in the "overview-grade" "table"
And I click on "Course 1" "link" in the "region-main" "region"
And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
And I set the following settings for grade item "Test outcome item one":
| Extra credit | 1 |
| Extra credit | 1 |
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
Then I should see "114.00 (18.39 %)" in the "overview-grade" "table"
And I click on "Course 1" "link" in the "region-main" "region"
And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
And I set the following settings for grade item "Course 1":
| Aggregation | Natural |
| Include outcomes in aggregation | 0 |
@@ -300,6 +293,7 @@ Feature: We can use calculated grade totals
And I set the following settings for grade item "Test outcome item one":
| Weight adjusted | 1 |
| aggregationcoef2 | 100 |
And I change window size to "large"
And I navigate to "View > Grader report" in the course gradebook
And I give the grade "Excellent" to the user "Student 1" for the grade item "Test outcome item one"
And I press "Save changes"
@@ -368,10 +362,7 @@ Feature: We can use calculated grade totals
| Test assignment four | 30.93 % | - | 0150 | 0.00 % |
Scenario: Natural aggregation with drop lowest
When I log out
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
When I am on the "Course 1" "grades > Grader report > View" page logged in as "admin"
And I turn editing mode on
And I set the following settings for grade item "Sub category 1":
| Aggregation | Natural |
@@ -418,9 +409,9 @@ Feature: We can use calculated grade totals
And I should see "270.00 (27.27 %)" in the ".course" "css_element"
And I turn editing mode on
And I set the following settings for grade item "Manual item 2":
| Extra credit | 0 |
| Maximum grade | 200 |
| Rescale existing grades | No |
| Maximum grade | 200 |
| Extra credit | 0 |
# Change window size to ultra-wide to avoid 'out-of-bounds' random failures.
And I change window size to "5120x2160"
And I give the grade "21.00" to the user "Student 1" for the grade item "Manual item 2"
@@ -431,9 +422,9 @@ Feature: We can use calculated grade totals
And I should see "270.00 (22.69 %)" in the ".course" "css_element"
And I turn editing mode on
And I set the following settings for grade item "Manual item 2":
| Extra credit | 0 |
| Maximum grade | 100 |
| Rescale existing grades | No |
| Maximum grade | 100 |
| Extra credit | 0 |
# Change window size to ultra-wide to avoid 'out-of-bounds' random failures.
And I change window size to "5120x2160"
And I give the grade "21.00" to the user "Student 1" for the grade item "Manual item 2"
@@ -451,7 +442,6 @@ Feature: We can use calculated grade totals
And I navigate to "View > Grader report" in the course gradebook
And I should see "270.00 (24.77 %)" in the ".course" "css_element"
@javascript
Scenario: Natural aggregation from the setup screen
And I navigate to "Setup > Gradebook setup" in the course gradebook
@@ -504,7 +494,6 @@ Feature: We can use calculated grade totals
And I reset weights for grade category "Sub category 2 &"
And the field "Weight of Test assignment ten" matches value "33.333"
@javascript
Scenario: Natural aggregation with weights of zero
When I set the following settings for grade item "Course 1":
| Aggregation | Natural |
@@ -33,8 +33,7 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I log in as "admin"
And I set the following administration settings values:
| grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page
And I turn editing mode on
And I follow "Edit Cat mean"
And I set the following fields to these values:
@@ -18,9 +18,7 @@ Feature: Calculated grade items can be used in the gradebook
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
@javascript
Scenario: The max grade for a category item, with a calculation using Natural aggregation, can be changed
@@ -19,9 +19,7 @@ Feature: Gradebook calculations for calculated grade items before the fix 201506
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
@javascript
Scenario: The max grade for a category item, with a calculation using Natural aggregation, can be changed
@@ -24,23 +24,20 @@ Feature: We can understand the gradebook user report
| assign | C1 | a4 | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment four | Submit something! |
| assign | C1 | a5 | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment five | Submit something! |
| assign | C1 | a6 | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment six | Submit something! |
And the following "grade grades" exist:
| gradeitem | user | grade |
| <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment one | student1 | 60.00 |
| <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment two | student1 | 20.00 |
| <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment three | student1 | 40.00 |
| <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment four | student1 | 10.00 |
| <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment five | student1 | 70.00 |
| <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment six | student1 | 30.00 |
And the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
And I log in as "admin"
And I set the following administration settings values:
| grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "60.00" to the user "Student 1" for the grade item "EN Test assignment one"
And I give the grade "20.00" to the user "Student 1" for the grade item "EN Test assignment two"
And I give the grade "40.00" to the user "Student 1" for the grade item "EN Test assignment three"
And I give the grade "10.00" to the user "Student 1" for the grade item "EN Test assignment four"
And I give the grade "70.00" to the user "Student 1" for the grade item "EN Test assignment five"
And I give the grade "30.00" to the user "Student 1" for the grade item "EN Test assignment six"
And I press "Save changes"
And I am on the "Course 1" "grades > course grade settings" page logged in as "teacher1"
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the field "Show weightings" to "Show"
And I set the field "Show contribution to course total" to "Show"
@@ -32,10 +32,7 @@ Feature: Editing a grade item
And I press "Save changes"
And I set the following administration settings values:
| grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as teacher1
And I press "Add category"
And I set the following fields to these values:
| Category name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Cat 1 |
@@ -19,8 +19,7 @@ Feature: Extra credit contributions are normalised when going out of bounds
And I log in as "admin"
And I set the following administration settings values:
| grade_aggregations_visible | Simple weighted mean of grades,Mean of grades (with extra credits),Natural |
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page
And I press "Add grade item"
And I set the following fields to these values:
| Item name | Manual item 1 |
@@ -42,10 +41,7 @@ Feature: Extra credit contributions are normalised when going out of bounds
And I set the field "Show weighting" to "Show"
And I set the field "Show contribution to course total" to "Show"
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Manual item 1"
And I give the grade "10.00" to the user "Student 1" for the grade item "Manual item 2"
@@ -19,9 +19,7 @@ Feature: We can change the maximum and minimum number of points for manual items
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
And I press "Add grade item"
And I set the following fields to these values:
| Item name | Manual item 1 |
@@ -34,8 +32,7 @@ Feature: We can change the maximum and minimum number of points for manual items
And I press "Save changes"
Scenario: Change maximum number of points on a graded item.
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
Given I am on the "Course 1" "grades > Grader report > View" page
And I turn editing mode on
And I give the grade "10.00" to the user "Student 1" for the grade item "Manual item 1"
And I give the grade "8.00" to the user "Student 2" for the grade item "Manual item 1"
+4 -12
View File
@@ -29,8 +29,7 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
And I log in as "admin"
And the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page
And I press "Add grade item"
And I set the following fields to these values:
| Item name | calculated |
@@ -42,10 +41,7 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
And I navigate to "Grades > Report settings > User report" in site administration
And I set the field "s__grade_report_user_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I press "Save changes"
When I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
When I am on the "Course 1" "grades > Grader report > View" page logged in as teacher1
And I turn editing mode on
And I give the grade "50.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "50.00" to the user "Student 1" for the grade item "Test assignment three"
@@ -53,8 +49,7 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
And I set the following settings for grade item "Test assignment four":
| Hidden | 1 |
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "View > User report" in the course gradebook
And I am on the "Course 1" "grades > User report > View" page
And I select "Myself" from the "View report as" singleselect
And I select "Student 1" from the "Select all or one user" singleselect
Then the following should exist in the "user-grade" table:
@@ -63,10 +58,7 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
| Test assignment two | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
| Test assignment three | 100.00 % | 50.00 | 0100 | 50.00 % | 25.00 % |
| Course total | - | 100.00 | 0200 | 50.00 % | - |
When I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I navigate to "User report" in the course gradebook
When I am on the "Course 1" "grades > User report > View" page logged in as student1
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 100.00 % | 50.00 | 0100 | 50.00 % | 25.00 % |
@@ -17,9 +17,7 @@ Feature: Hidden grade items should be hidden when grade category is locked, but
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
And I press "Add category"
And I set the following fields to these values:
| Category name | Test locked category |
@@ -30,23 +28,16 @@ Feature: Hidden grade items should be hidden when grade category is locked, but
| Hidden | 1 |
| Grade category | Test locked category |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
And I give the grade "50.00" to the user "Student 1" for the grade item "Hidden item"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "Test locked category":
| Locked | 1 |
And I press "Save changes"
And I log out
Scenario: Hidden grade items in locked category is hidden for teacher
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > User report" in the course gradebook
Given I am on the "Course 1" "grades > User report > View" page logged in as teacher1
And I select "Myself" from the "View report as" singleselect
When I select "Student 1" from the "Select all or one user" singleselect
Then the following should exist in the "user-grade" table:
@@ -55,9 +46,7 @@ Feature: Hidden grade items should be hidden when grade category is locked, but
| Course total | - | 50.00 | 0100 | 50.00 % | - |
Scenario: Hidden grade items in locked category is hidden for student
Given I log in as "student1"
And I am on "Course 1" course homepage
When I navigate to "User report" in the course gradebook
When I am on the "Course 1" "grades > User report > View" page logged in as student1
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test locked category total | 100.00 % | - | 0100 | - | - |
@@ -65,9 +54,7 @@ Feature: Hidden grade items should be hidden when grade category is locked, but
And I should not see "Hidden item"
Scenario: Hidden grade items in overridden category should show
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
Given I am on the "Course 1" "grades > gradebook setup" page logged in as teacher1
And I press "Add category"
And I set the following fields to these values:
| Category name | Test overridden category B|
@@ -81,10 +68,7 @@ Feature: Hidden grade items should be hidden when grade category is locked, but
And I turn editing mode on
And I give the grade "50.00" to the user "Student 1" for the grade item "Test overridden category B total"
And I press "Save changes"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I navigate to "User report" in the course gradebook
And I am on the "Course 1" "grades > User report > View" page logged in as "student1"
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test locked category total | 50.00 % | - | 0100 | - | - |
@@ -25,9 +25,7 @@ Feature: We can duplicate grade items that already exist.
| Item1 | C1 | Category1 | 001 | Value | 80.00 | 5.00 | 40.00 | 1 | 1 | 0 | 1 |
Scenario: Ensure the duplicated grade item settings match the original grade item
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
Given I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
And I should not see "Duplicate Category1"
And I should not see "Duplicate Assignment1"
When I duplicate the grade item "Item1"
@@ -26,28 +26,19 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
| Grade out of 100 | 50 |
| Feedback comments | I'm the teacher feedback |
And I press "Save changes"
And I am on "Course 1" course homepage
And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should see "50.00"
And I should see "I'm the teacher feedback" in the "Feedback comments" "table_row"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
@javascript
Scenario: Hiding the activity using the drop-down hide link and then unhiding the activity using the edit settings form page
Given I click on "Edit" "link" in the "Test assignment name" "table_row"
And I click on "Hide" "link" in the "Test assignment name" "table_row"
And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should not see "50.00"
And I should not see "I'm the teacher feedback"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
And I click on "Edit" "link" in the "Test assignment name" "table_row"
And I click on "Edit settings" "link" in the "Test assignment name" "table_row"
And the field "Hidden" matches value "1"
@@ -68,13 +59,9 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should not see "50.00"
And I should not see "I'm the teacher feedback"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
And I click on "Edit" "link" in the "Test assignment name" "table_row"
And I click on "Show" "link" in the "Test assignment name" "table_row"
And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1
Then I should see "50.00"
And I should see "I'm the teacher feedback" in the "Feedback comments" "table_row"
@@ -83,20 +70,15 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
Scenario: Hiding the category using the drop-down hide link and then unhiding the category using the edit settings form page
Given I click on "Edit" "link" in the "Course 1" "table_row"
And I click on "Hide" "link" in the "Course 1" "table_row"
And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should not see "50.00"
And I should not see "I'm the teacher feedback"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
And I click on "Edit" "link" in the "Course 1" "table_row"
And I click on "Edit settings" "link" in the "Course 1" "table_row"
And the field "Hidden" matches value "1"
And I set the field "Hidden" to "0"
And I press "Save changes"
And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1
Then I should see "50.00"
And I should see "I'm the teacher feedback" in the "Feedback comments" "table_row"
@@ -107,17 +89,12 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
And I click on "Edit settings" "link" in the "Course 1" "table_row"
And I set the field "Hidden" to "1"
And I press "Save changes"
And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should not see "50.00"
And I should not see "I'm the teacher feedback"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
And I click on "Edit" "link" in the "Course 1" "table_row"
And I click on "Show" "link" in the "Course 1" "table_row"
And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1
Then I should see "50.00"
And I should see "I'm the teacher feedback" in the "Feedback comments" "table_row"
@@ -30,8 +30,7 @@ Feature: Grade item validation
| Name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Letter scale |
| Scale | Disappointing, Good, Very good, Excellent |
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page
And I press "Add grade item"
And I set the following fields to these values:
| Item name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> MI 1 |
@@ -20,9 +20,7 @@ Feature: We can customise the letter boundary of a course.
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one | Submit something! | 100 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Course grade settings" in the course gradebook
And I am on the "Course 1" "grades > course grade settings" page logged in as "teacher1"
And I set the following fields to these values:
| Grade display type | Letter |
And I press "Save changes"
@@ -21,9 +21,7 @@ Feature: We can customise the letter boundary of a course in gradebook version 2
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one | Submit something! | 100 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Course grade settings" in the course gradebook
And I am on the "Course 1" "grades > course grade settings" page logged in as "teacher1"
And I set the following fields to these values:
| Grade display type | Letter |
And I press "Save changes"
@@ -8,9 +8,7 @@ Feature: We can view the logs for any changes to grade letters.
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Setup > Course grade settings" in the course gradebook
And I am on the "Course 1" "grades > course grade settings" page logged in as "admin"
And I set the following fields to these values:
| Grade display type | Letter |
And I press "Save changes"
+2 -6
View File
@@ -25,8 +25,7 @@ Feature: We can use a minimum grade different than zero
And I log in as "admin"
And I set the following administration settings values:
| grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page
And I press "Add grade item"
And I set the following fields to these values:
| Item name | Manual item 1 |
@@ -81,10 +80,7 @@ Feature: We can use a minimum grade different than zero
And I set the following settings for grade item "Course 1":
| Aggregation | Natural |
| Exclude empty grades | 0 |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
When I give the grade "-25.00" to the user "Student 1" for the grade item "Manual item 1"
And I give the grade "50.00" to the user "Student 1" for the grade item "Manual item 2"
+2 -6
View File
@@ -24,8 +24,7 @@ Feature: We can choose what min or max grade to use when aggregating grades.
And I log in as "admin"
And I set the following administration settings values:
| grade_minmaxtouse | Min and max grades as specified in grade item settings |
And I am on "C1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "C1" "grades > gradebook setup" page
And I press "Add grade item"
And I set the following fields to these values:
| Item name | MI 1 |
@@ -63,10 +62,7 @@ Feature: We can choose what min or max grade to use when aggregating grades.
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "CAT1":
| Aggregation | Natural |
And I log out
And I log in as "teacher1"
And I am on "C1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "C1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
And I give the grade "75.00" to the user "Student 1" for the grade item "MI 1"
And I give the grade "25.00" to the user "Student 1" for the grade item "MI 2"
@@ -23,9 +23,7 @@ Feature: Weights in natural aggregation are adjusted if the items are excluded f
| assign | C1 | a3 | Test assignment three | x | 200 |
| assign | C1 | a4 | Test assignment four (extra) | x | 20 |
| assign | C1 | a5 | Test assignment five (extra) | x | 10 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
And I set the following settings for grade item "Test assignment four (extra)":
| Extra credit | 1 |
And I set the following settings for grade item "Test assignment five (extra)":
@@ -24,9 +24,7 @@ Feature: Gradebook calculations for extra credit items before the fix 20150619
| assign | C1 | a3 | Test assignment three | x | 200 |
| assign | C1 | a4 | Test assignment four (extra) | x | 20 |
| assign | C1 | a5 | Test assignment five (extra) | x | 10 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
And I set the following settings for grade item "Test assignment four (extra)":
| Extra credit | 1 |
And I set the following settings for grade item "Test assignment five (extra)":
@@ -32,9 +32,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
| assign | C1 | a7 | Test assignment seven | Submit nothing! | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Sub category 1 | 15 |
And the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
@javascript
Scenario: Setting all weights in a category to exactly one hundred in total.
@@ -31,9 +31,7 @@ Feature: Gradebook calculations for natural weights normalisation before the fix
| assign | C1 | a5 | Test assignment five | Submit something! | Sub category 1 | 20 |
| assign | C1 | a6 | Test assignment six | Submit something! | Sub category 1 | 10 |
| assign | C1 | a7 | Test assignment seven | Submit nothing! | Sub category 1 | 15 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
@javascript
Scenario: Grade items weights are normalised when all grade item weights are overridden (sum exactly 100). Extra credit is set to zero (before the fix 20150619).
@@ -30,8 +30,7 @@ Feature: Regrading grades does not unnecessarily mark some as overriden
And I press "Save and show next"
And I set the field "Grade out of 100" to "60"
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page
And the following should exist in the "gradereport-grader-table" table:
| | | |
| First name / Surname | Assignment 1 | Course total |
@@ -40,7 +39,6 @@ Feature: Regrading grades does not unnecessarily mark some as overriden
And I turn editing mode on
And I give the grade "80.00" to the user "Student 2" for the grade item "Course total"
And I press "Save changes"
And I navigate to "View > Grader report" in the course gradebook
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I click on "Edit" "link" in the ".coursecategory" "css_element"
And I click on "Edit settings" "link" in the ".coursecategory" "css_element"
@@ -64,8 +62,7 @@ Feature: Regrading grades does not unnecessarily mark some as overriden
And I press "Save and show next"
And I set the field "Grade out of 100" to "70"
And I press "Save changes"
When I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
When I am on the "Course 1" "grades > Grader report > View" page
Then the following should exist in the "gradereport-grader-table" table:
| | | |
| First name / Surname | Assignment 1 | Course total |
@@ -1,4 +1,4 @@
@core @core_grades
@core @core_grades @javascript
Feature: Control the aggregation of the scales
In order to use control the aggregation of the scales
As an admin
@@ -34,12 +34,9 @@ Feature: Control the aggregation of the scales
| Scale me | C1 | Letterscale |
And the following config values are set as admin:
| grade_includescalesinaggregation | 0 |
And I log out
Scenario Outline: Scales can be excluded from aggregation
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
Given I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
When I give the grade "10" to the user "Student 1" for the grade item "Grade me"
And I give the grade "B" to the user "Student 1" for the grade item "Scale me"
@@ -57,10 +54,7 @@ Feature: Control the aggregation of the scales
And I log in as "admin"
And I set the following administration settings values:
| grade_includescalesinaggregation | 1 |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > User report" in the course gradebook
And I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"
And I select "Student 1" from the "Select all or one user" singleselect
And the following should exist in the "user-grade" table:
| Grade item | Grade | Percentage | Contribution to course total |
@@ -80,11 +74,8 @@ Feature: Control the aggregation of the scales
| Highest grade | Highest grade. | 10.00 | 10.00 % | 10.00 | 0.00 | 75.00 | 75.00 % | 0.00 % | 75.00 % |
| Mode of grades | Mode of grades. | 10.00 | 10.00 % | 10.00 | 0.00 | 75.00 | 75.00 % | 0.00 % | 75.00 % |
@javascript
Scenario: Weights of scales cannot be edited when they are not aggregated
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
Given I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
When I set the following settings for grade item "Course 1":
| Aggregation | Natural |
@@ -48,8 +48,7 @@ Feature: View gradebook when single item scales are used
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade" to "A"
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "Setup > Course grade settings" in the course gradebook
When I am on the "Course 1" "grades > course grade settings" page
And I set the field "Show weightings" to "Show"
And I set the field "Show contribution to course total" to "Show"
And I press "Save changes"
+6 -28
View File
@@ -18,31 +18,13 @@ Feature: We can enter in grades and view reports from the gradebook
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| assign | Test assignment name 1 | Submit your online text | C1 | 1 | assign1 |
| assign | Test assignment name 2 | Submit your online text | C1 | 1 | assign2 |
| activity | name | course | idnumber | assignsubmission_onlinetext_enabled |
| assign | Test assignment name 1 | C1 | assign1 | 1 |
| assign | Test assignment name 2 | C1 | assign2 | 1 |
And I log in as "admin"
And I set the following administration settings values:
| grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name 1"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
And I press "Save and return to course"
And I follow "Test assignment name 2"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
And I press "Save and return to course"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name 1"
And I am on the "Test assignment name 1" "assign activity" page logged in as student1
When I press "Add submission"
And I set the following fields to these values:
| Online text | This is a submission for assignment 1 |
@@ -50,8 +32,7 @@ Feature: We can enter in grades and view reports from the gradebook
And I press "Submit assignment"
And I press "Continue"
Then I should see "Submitted for grading"
And I am on "Course 1" course homepage
And I follow "Test assignment name 2"
And I am on the "Test assignment name 2" "assign activity" page
When I press "Add submission"
And I set the following fields to these values:
| Online text | This is a submission for assignment 2 |
@@ -59,10 +40,7 @@ Feature: We can enter in grades and view reports from the gradebook
And I press "Submit assignment"
And I press "Continue"
Then I should see "Submitted for grading"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment name 1"
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment name 2"
+1 -1
View File
@@ -333,7 +333,7 @@ class helper {
// When there is a logged in user, her information will be passed to the player. It will be used for tracking.
$usersettings = [];
if (isloggedin()) {
$usersettings['name'] = $USER->username;
$usersettings['name'] = fullname($USER, has_capability('moodle/site:viewfullnames', $systemcontext));
$usersettings['id'] = $USER->id;
}
$settings = array(
+1
View File
@@ -459,6 +459,7 @@ $string['customusermenuitems'] = 'User menu items';
$string['datarootsecurityerror'] = '<p><strong>SECURITY WARNING!</strong></p><p>Your dataroot directory is in the wrong location and is exposed to the web. This means that all your private files are available to anyone in the world, and some of them could be used by a cracker to obtain unauthorised administrative access to your site!</p>
<p>You <em>must</em> move dataroot directory ({$a}) to a new location that is not within your public web directory, and update the <code>$CFG->dataroot</code> setting in your config.php accordingly.</p>';
$string['datarootsecuritywarning'] = 'Your site configuration might not be secure. Please make sure that your dataroot directory ({$a}) is not directly accessible via web.';
$string['dbprefixtoolong'] = 'Your site\'s database prefix ($CFG->prefix) is too long ({$a->current} characters). The maximum number of characters allowed is {$a->maximum}.';
$string['dbsessions'] = 'Use database for session information';
$string['debug'] = 'Debug messages';
$string['debugall'] = 'ALL: Show all reasonable PHP debug messages';
+54
View File
@@ -205,3 +205,57 @@ function min_get_slash_argument($clean = true) {
}
return $relativepath;
}
/**
* Get the lowest possible currently valid revision number.
*
* This is based on the current Moodle version.
*
* @return int Unix timestamp
*/
function min_get_minimum_revision(): int {
static $timestamp = null;
if ($timestamp === null) {
global $CFG;
require("{$CFG->dirroot}/version.php");
// Get YYYYMMDD from version.
$datestring = floor($version / 100);
// Parse the date components.
$year = intval(substr($datestring, 0, 4));
$month = intval(substr($datestring, 4, 2));
$day = intval(substr($datestring, 6, 2));
// Return converted GMT Unix timestamp.
$timestamp = gmmktime(0, 0, 0, $month, $day, $year);
}
return $timestamp;
}
/**
* Get the highest possible currently valid revision number.
*
* This is based on the current time, allowing for a small amount of clock skew between servers.
*
* Future values beyond the clock skew are not allowed to avoid the possibility of cache poisoning.
*
* @return int
*/
function min_get_maximum_revision(): int {
return time() + 60;
}
/**
* Helper function to determine if the given revision number is valid.
*
* @param int $revision A numeric revision to check for validity
* @return bool Whether the revision is valid
*/
function min_is_revision_valid_and_current(int $revision): bool {
// Invalid revision.
if ($revision <= 0) {
return false;
}
// Check revision is within range.
return $revision >= min_get_minimum_revision() && $revision <= min_get_maximum_revision();
}
+4 -2
View File
@@ -228,8 +228,10 @@ class filter_manager {
public function filter_text($text, $context, array $options = array(),
array $skipfilters = null) {
$text = $this->apply_filter_chain($text, $this->get_text_filters($context), $options, $skipfilters);
// Remove <nolink> tags for XHTML compatibility.
$text = str_replace(array('<nolink>', '</nolink>'), '', $text);
if (!isset($options['stage']) || $options['stage'] === 'post_clean') {
// Remove <nolink> tags for XHTML compatibility after the last filtering stage.
$text = str_replace(array('<nolink>', '</nolink>'), '', $text);
}
return $text;
}
+6 -2
View File
@@ -47,6 +47,11 @@ if ($slashargument = min_get_slash_argument()) {
$file = min_optional_param('jsfile', '', 'RAW'); // 'file' would collide with URL rewriting!
}
if (!min_is_revision_valid_and_current($rev)) {
// If the rev is invalid, normalise it to -1 to disable all caching.
$rev = -1;
}
// some security first - pick only files with .js extension in dirroot
$jsfiles = array();
$files = explode(',', $file);
@@ -79,8 +84,7 @@ if (!$jsfiles) {
$etag = sha1($rev.implode(',', $jsfiles));
// Use the caching only for meaningful revision numbers which prevents future cache poisoning.
if ($rev > 0 and $rev < (time() + 60*60)) {
if ($rev > 0) {
$candidate = $CFG->localcachedir.'/js/'.$etag;
if (file_exists($candidate)) {
+16 -35
View File
@@ -10323,52 +10323,33 @@ function get_course_display_name_for_list($course) {
* Safe analogue of unserialize() that can only parse arrays
*
* Arrays may contain only integers or strings as both keys and values. Nested arrays are allowed.
* Note: If any string (key or value) has semicolon (;) as part of the string parsing will fail.
* This is a simple method to substitute unnecessary unserialize() in code and not intended to cover all possible cases.
*
* @param string $expression
* @return array|bool either parsed array or false if parsing was impossible.
*/
function unserialize_array($expression) {
$subs = [];
// Find nested arrays, parse them and store in $subs , substitute with special string.
while (preg_match('/([\^;\}])(a:\d+:\{[^\{\}]*\})/', $expression, $matches) && strlen($matches[2]) < strlen($expression)) {
$key = '--SUB' . count($subs) . '--';
$subs[$key] = unserialize_array($matches[2]);
if ($subs[$key] === false) {
return false;
}
$expression = str_replace($matches[2], $key . ';', $expression);
}
// Check the expression is an array.
if (!preg_match('/^a:(\d+):\{([^\}]*)\}$/', $expression, $matches1)) {
if (!preg_match('/^a:(\d+):/', $expression)) {
return false;
}
// Get the size and elements of an array (key;value;key;value;....).
$parts = explode(';', $matches1[2]);
$size = intval($matches1[1]);
if (count($parts) < $size * 2 + 1) {
return false;
}
// Analyze each part and make sure it is an integer or string or a substitute.
$value = [];
for ($i = 0; $i < $size * 2; $i++) {
if (preg_match('/^i:(\d+)$/', $parts[$i], $matches2)) {
$parts[$i] = (int)$matches2[1];
} else if (preg_match('/^s:(\d+):"(.*)"$/', $parts[$i], $matches3) && strlen($matches3[2]) == (int)$matches3[1]) {
$parts[$i] = $matches3[2];
} else if (preg_match('/^--SUB\d+--$/', $parts[$i])) {
$parts[$i] = $subs[$parts[$i]];
} else {
return false;
$values = (array) unserialize_object($expression);
// Callback that returns true if the given value is an unserialized object, executes recursively.
$invalidvaluecallback = static function($value) use (&$invalidvaluecallback): bool {
if (is_array($value)) {
return (bool) array_filter($value, $invalidvaluecallback);
}
return ($value instanceof stdClass) || ($value instanceof __PHP_Incomplete_Class);
};
// Iterate over the result to ensure there are no stray objects.
if (array_filter($values, $invalidvaluecallback)) {
return false;
}
// Combine keys and values.
for ($i = 0; $i < $size * 2; $i += 2) {
$value[$parts[$i]] = $parts[$i+1];
}
return $value;
return $values;
}
/**
+32
View File
@@ -2189,4 +2189,36 @@ EOF;
}
}
/**
* Check that the page title contains a given string.
*
* @Given the page title should contain ":title"
* @param string $title The string that should be present on the page title.
*/
public function the_page_title_should_contain(string $title): void {
$session = $this->getSession();
if ($this->running_javascript()) {
// When running on JS, the page title can be changed via JS, so it's more reliable to get the actual page title via JS.
$actualtitle = $session->evaluateScript("return document.title");
} else {
$titleelement = $session->getPage()->find('css', 'head title');
if ($titleelement === null) {
// Throw an exception if a page title is not present on the page.
throw new ElementNotFoundException(
$this->getSession(),
'<title> element',
'css',
'head title'
);
}
$actualtitle = $titleelement->getText();
}
if (strpos($actualtitle, $title) === false) {
throw new ExpectationException(
"'$title' was not found from the current page title '$actualtitle'",
$session
);
}
}
}
+72 -1
View File
@@ -21,7 +21,6 @@ defined('MOODLE_INTERNAL') || die();
// Global $CFG not used here intentionally to make sure it is not required inside the lib.
require_once(__DIR__ . '/../configonlylib.php');
/**
* Unit tests for config only library functions.
*
@@ -144,4 +143,76 @@ class configonlylib_test extends \advanced_testcase {
// Windows dir separators are removed, multiple ... gets collapsed to one .
$this->assertSame('/standardcore/./5/u/f1', min_get_slash_argument());
}
/**
* Test the min_get_minimum_version function.
*
* @covers ::min_get_minimum_version
*/
public function test_min_get_minimum_version(): void {
// This is fairly hard to write a test for, but we can at least check that it returns a number
// greater than the version when the feature was first introduced.
$firstintroduced = 1621209600; // Equivalent to 20210517 00:00:00 GMT.
$this->assertGreaterThanOrEqual($firstintroduced, min_get_minimum_revision());
}
/**
* Test the min_get_maximum_version function.
*
* @covers ::min_get_maximum_version
*/
public function test_min_get_maximum_version(): void {
// The maximum version should be set to a time in the near future.
// This is currently defined as "in the next minute".
// Note: We use a 65 second window to allow for slow test runners.
$this->assertGreaterThan(time(), min_get_maximum_revision());
$this->assertLessThanOrEqual(time() + 65, min_get_maximum_revision());
}
/**
* Test the min_is_revision_valid_and_current function.
*
* @covers ::min_is_revision_valid_and_current
* @dataProvider min_is_revision_valid_and_current_provider
*/
public function test_min_is_revision_valid_and_current(int $revision, bool $expected): void {
$this->assertEquals($expected, min_is_revision_valid_and_current($revision));
}
/**
* Data provider for the min_is_revision_valid_and_current tests.
*
* @return array
*/
public function min_is_revision_valid_and_current_provider(): array {
return [
'Negative value' => [-1, false],
'Empty value' => [0, false],
'A time before the minimum accepted value' => [min_get_minimum_revision() - 1, false],
'The minimum accepted value' => [min_get_minimum_revision(), true],
'The current time' => [time(), true],
// Note: We have to be careful using time values because the data provider is run at the start of the phpunit run,
// but the test may not be run for some time.
// On a slower machine and/or database, this could be several hours.
// For a more specific time we must have a specific test function.
'A time in the future' => [time() + DAYSECS, false]
];
}
/**
* Test the min_is_revision_valid_and_current function with close times.
*
* Note: These tests are incompatible with data providers.
*
* @covers ::min_is_revision_valid_and_current
*/
public function test_min_is_revision_valid_and_current_close_proximity(): void {
// A time in the near future.
$this->assertTrue(min_is_revision_valid_and_current(time() + 55));
// A time in the too-far future.
$this->assertFalse(min_is_revision_valid_and_current(time() + 70));
}
}
+9 -7
View File
@@ -4541,24 +4541,26 @@ EOF;
public function test_unserialize_array() {
$a = [1, 2, 3];
$this->assertEquals($a, unserialize_array(serialize($a)));
$this->assertEquals($a, unserialize_array(serialize($a)));
$a = ['a' => 1, 2 => 2, 'b' => 'cde'];
$this->assertEquals($a, unserialize_array(serialize($a)));
$this->assertEquals($a, unserialize_array(serialize($a)));
$a = ['a' => 1, 2 => 2, 'b' => 'c"d"e'];
$this->assertEquals($a, unserialize_array(serialize($a)));
$a = ['a' => 1, 2 => ['c' => 'd', 'e' => 'f'], 'b' => 'cde'];
$this->assertEquals($a, unserialize_array(serialize($a)));
// Can not unserialize if any string contains semicolons.
$a = ['a' => 1, 2 => ['c' => 'd', 'e' => ['f' => 'g']], 'b' => 'cde'];
$this->assertEquals($a, unserialize_array(serialize($a)));
$a = ['a' => 1, 2 => 2, 'b' => 'c"d";e'];
$this->assertEquals(false, unserialize_array(serialize($a)));
$this->assertEquals($a, unserialize_array(serialize($a)));
// Can not unserialize if there are any objects.
$a = (object)['a' => 1, 2 => 2, 'b' => 'cde'];
$this->assertEquals(false, unserialize_array(serialize($a)));
$this->assertFalse(unserialize_array(serialize($a)));
$a = ['a' => 1, 2 => 2, 'b' => (object)['a' => 'cde']];
$this->assertEquals(false, unserialize_array(serialize($a)));
$this->assertFalse(unserialize_array(serialize($a)));
$a = ['a' => 1, 2 => 2, 'b' => ['c' => (object)['a' => 'cde']]];
$this->assertFalse(unserialize_array(serialize($a)));
$a = ['a' => 1, 2 => 2, 'b' => ['c' => new lang_string('no')]];
$this->assertFalse(unserialize_array(serialize($a)));
// Array used in the grader report.
$a = array('aggregatesonly' => [51, 34], 'gradesonly' => [21, 45, 78]);
+38
View File
@@ -19,6 +19,8 @@ namespace core;
/**
* Unit tests for format_text defined in weblib.php.
*
* @covers ::format_text
*
* @package core
* @category test
* @copyright 2015 The Open University
@@ -88,6 +90,42 @@ class weblib_format_text_test extends \advanced_testcase {
format_text('<p>:-)</p>', FORMAT_MOODLE, array('filter' => false)));
}
/**
* Make sure that nolink tags and spans prevent linking in filters that support it.
*/
public function test_format_text_nolink() {
global $CFG;
$this->resetAfterTest();
filter_set_global_state('activitynames', TEXTFILTER_ON);
$course = $this->getDataGenerator()->create_course();
$context = \context_course::instance($course->id);
$page = $this->getDataGenerator()->create_module('page',
['course' => $course->id, 'name' => 'Test 1']);
$cm = get_coursemodule_from_instance('page', $page->id, $page->course, false, MUST_EXIST);
$pageurl = $CFG->wwwroot. '/mod/page/view.php?id=' . $cm->id;
$this->assertSame(
'<p>Read <a class="autolink" title="Test 1" href="' . $pageurl . '">Test 1</a>.</p>',
format_text('<p>Read Test 1.</p>', FORMAT_HTML, ['context' => $context]));
$this->assertSame(
'<p>Read <a class="autolink" title="Test 1" href="' . $pageurl . '">Test 1</a>.</p>',
format_text('<p>Read Test 1.</p>', FORMAT_HTML, ['context' => $context, 'noclean' => true]));
$this->assertSame(
'<p>Read Test 1.</p>',
format_text('<p><nolink>Read Test 1.</nolink></p>', FORMAT_HTML, ['context' => $context, 'noclean' => false]));
$this->assertSame(
'<p>Read Test 1.</p>',
format_text('<p><nolink>Read Test 1.</nolink></p>', FORMAT_HTML, ['context' => $context, 'noclean' => true]));
$this->assertSame(
'<p><span class="nolink">Read Test 1.</span></p>',
format_text('<p><span class="nolink">Read Test 1.</span></p>', FORMAT_HTML, ['context' => $context]));
}
public function test_format_text_overflowdiv() {
$this->assertEquals('<div class="no-overflow"><p>Hello world</p></div>',
format_text('<p>Hello world</p>', FORMAT_HTML, array('overflowdiv' => true)));
+5
View File
@@ -1,6 +1,11 @@
This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 3.11.17 ===
* New Behat step \behat_general::the_page_title_should_contain() has been added to allow checking of page titles. You can use this
when writing feature files to check that the page title contains the expected string.
e.g. `And the page title should contain "Some title"`
=== 3.11.15 ===
* Added a new parameter in address_in_subnet to give us the ability to check for 0.0.0.0 or not.
+20
View File
@@ -2487,6 +2487,26 @@ function check_igbinary322_version(environment_results $result) {
return $result;
}
/**
* This function checks that the database prefix ($CFG->prefix) is <= 10
*
* @param environment_results $result
* @return environment_results|null updated results object, or null if the prefix check is passing ok.
*/
function check_db_prefix_length(environment_results $result) {
global $CFG;
$prefixlen = strlen($CFG->prefix) ?? 0;
if ($prefixlen > 10) {
$parameters = (object)['current' => $prefixlen, 'maximum' => 10];
$result->setFeedbackStr(['dbprefixtoolong', 'admin', $parameters]);
$result->setInfo('db prefix too long');
$result->setStatus(false);
return $result;
}
return null; // All, good. By returning null we hide the check.
}
/**
* Assert the upgrade key is provided, if it is defined.
*
+2 -2
View File
@@ -2830,7 +2830,7 @@ class core_message_external extends external_api {
return new external_function_parameters(
array(
'userid' => new external_value(PARAM_INT, 'id of the user, 0 for current user', VALUE_REQUIRED),
'name' => new external_value(PARAM_TEXT, 'The name of the message processor'),
'name' => new external_value(PARAM_SAFEDIR, 'The name of the message processor'),
'formvalues' => new external_multiple_structure(
new external_single_structure(
array(
@@ -2906,7 +2906,7 @@ class core_message_external extends external_api {
return new external_function_parameters(
array(
'userid' => new external_value(PARAM_INT, 'id of the user, 0 for current user'),
'name' => new external_value(PARAM_TEXT, 'The name of the message processor', VALUE_REQUIRED),
'name' => new external_value(PARAM_SAFEDIR, 'The name of the message processor', VALUE_REQUIRED),
)
);
}
+2 -2
View File
@@ -702,8 +702,8 @@ function message_output_fragment_processor_settings($args = []) {
throw new moodle_exception('Must provide a userid');
}
$type = $args['type'];
$userid = $args['userid'];
$type = clean_param($args['type'], PARAM_SAFEDIR);
$userid = clean_param($args['userid'], PARAM_INT);
$user = core_user::get_user($userid, '*', MUST_EXIST);
if (!core_message_can_edit_message_profile($user)) {
@@ -24,7 +24,6 @@ Feature: Bulk released grades should not be sent to gradebook while submissions
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| markingworkflow | 1 |
@@ -32,31 +31,23 @@ Feature: Bulk released grades should not be sent to gradebook while submissions
| assignfeedback_comments_enabled | 1 |
| assignfeedback_editpdf_enabled | 1 |
# Add a submission.
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as "student1"
Then I should not see "Feedback"
And I should see "Not marked" in the "Grading status" "table_row"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm student1's submission |
And I press "Save changes"
And I log out
# Add another submission.
And I log in as "student2"
And I am on "Course 1" course homepage
When I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as "student2"
Then I should not see "Feedback"
And I should see "Not marked" in the "Grading status" "table_row"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm student2's submission |
And I press "Save changes"
And I log out
# Mark the submissions.
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as "teacher1"
And I navigate to "View all submissions" in current page administration
Then I should see "Not marked" in the "I'm student1's submission" "table_row"
And I click on "Grade" "link" in the "I'm student1's submission" "table_row"
@@ -93,37 +84,22 @@ Feature: Bulk released grades should not be sent to gradebook while submissions
And I navigate to "View all submissions" in current page administration
Then I should see "Released" in the "I'm student1's submission" "table_row"
And I should see "Released" in the "I'm student2's submission" "table_row"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I navigate to "User report" in the course gradebook
And I am on the "Course 1" "grades > User report > View" page logged in as "student1"
Then I should not see "50"
And I should not see "Great job!"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I navigate to "User report" in the course gradebook
And I am on the "Course 1" "grades > User report > View" page logged in as "student2"
Then I should not see "50"
And I should not see "Great job!"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as "teacher1"
And I navigate to "View all submissions" in current page administration
And I set the field "Grading action" to "Reveal student identities"
And I press "Continue"
Then I should see "Released" in the "Student 1" "table_row"
And I should see "Released" in the "Student 2" "table_row"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I navigate to "User report" in the course gradebook
And I am on the "Course 1" "grades > User report > View" page logged in as "student1"
Then I should see "50"
And I should see "Great job!"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I navigate to "User report" in the course gradebook
And I am on the "Course 1" "grades > User report > View" page logged in as "student2"
Then I should see "50"
And I should see "Great job!"
@@ -143,15 +119,9 @@ Feature: Bulk released grades should not be sent to gradebook while submissions
And I navigate to "View all submissions" in current page administration
Then I should see "Released" in the "Student 1" "table_row"
And I should see "Released" in the "Student 2" "table_row"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I navigate to "User report" in the course gradebook
And I am on the "Course 1" "grades > User report > View" page logged in as "student1"
Then I should see "50"
And I should see "Great job!"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I navigate to "User report" in the course gradebook
And I am on the "Course 1" "grades > User report > View" page logged in as "student2"
Then I should see "50"
And I should see "Great job!"
+7 -18
View File
@@ -20,22 +20,13 @@ Feature: Outcome grading
| student1 | C1 | student |
And the following config values are set as admin:
| enableoutcomes | 1 |
And I log in as "admin"
And I navigate to "Grades > Scales" in site administration
And I press "Add a new scale"
And I set the following fields to these values:
| Name | Test Scale |
| Scale | Disappointing, Excellent, Good, Very good, Excellent |
And I press "Save changes"
And I navigate to "Grades > Outcomes" in site administration
And I press "Add a new outcome"
And I set the following fields to these values:
| Full name | Outcome Test |
| Short name | OT |
| Scale | Test Scale |
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "Outcomes" in current page administration
And the following "scales" exist:
| name | scale |
| Test Scale | Disappointing, Excellent, Good, Very good, Excellent |
And the following "grade outcomes" exist:
| fullname | shortname | scale |
| Outcome Test | OT | Test Scale |
And I am on the "Course 1" "grades > outcomes" page logged in as admin
And I set the field "Available standard outcomes" to "Outcome Test"
And I click on "#add" "css_element"
And I log out
@@ -49,13 +40,11 @@ Feature: Outcome grading
| Description | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| Outcome Test | 1 |
And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I press "Add submission"
And I set the following fields to these values:
| Online text | My online text |
And I press "Save changes"
And I log out
When I am on the "Test assignment name" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 0" "table_row"
+5 -5
View File
@@ -21,14 +21,14 @@ Feature: In an assignment, page titles are informative
Scenario: I view an assignment as a student and take an action
When I am on the "History of ants" Activity page logged in as student1
Then "title[text() = 'C1: History of ants']" "xpath_element" should exist in the "head" "css_element"
Then the page title should contain "C1: History of ants"
And I press "Add submission"
And "title[text() = 'C1: History of ants - Edit submission']" "xpath_element" should exist in the "head" "css_element"
And the page title should contain "C1: History of ants - Edit submission"
Scenario: I view an assignment as a teacher and take an action
When I am on the "History of ants" Activity page logged in as teacher1
Then "title[text() = 'C1: History of ants']" "xpath_element" should exist in the "head" "css_element"
Then the page title should contain "C1: History of ants"
And I navigate to "View all submissions" in current page administration
And "title[text() = 'C1: History of ants - Grading']" "xpath_element" should exist in the "head" "css_element"
And the page title should contain "C1: History of ants - Grading"
And I click on "Grade" "link" in the "Student 1" "table_row"
And "title[text() = 'C1: History of ants - Grading']" "xpath_element" should exist in the "head" "css_element"
And the page title should contain "C1: History of ants - Grading"
+11 -39
View File
@@ -32,8 +32,7 @@ Feature: In an assignment, teachers grade multiple students on one page
And I navigate to "View all submissions" in current page administration
When I click on "Grade" "link" in the "Student 1" "table_row"
And I press "Save changes"
And I click on "Edit settings" "link"
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page
Then I should see "1" in the "Needs grading" "table_row"
@skip_chrome_zerosize
@@ -53,9 +52,7 @@ Feature: In an assignment, teachers grade multiple students on one page
| student2 | C1 | student |
And the following config values are set as admin:
| enableoutcomes | 1 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Outcomes" in current page administration
When I am on the "Course 1" "grades > outcomes" page logged in as teacher1
And I follow "Edit outcomes"
And I press "Add a new outcome"
And I follow "Add a new scale"
@@ -63,8 +60,7 @@ Feature: In an assignment, teachers grade multiple students on one page
| Name | 1337dom scale |
| Scale | Noob, Nub, 1337, HaXor |
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "Outcomes" in current page administration
And I am on the "Course 1" "grades > outcomes" page
And I follow "Edit outcomes"
And I press "Add a new outcome"
And I set the following fields to these values:
@@ -79,26 +75,17 @@ Feature: In an assignment, teachers grade multiple students on one page
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| M8d skillZ! | 1 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student1 submission |
And I press "Save changes"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as student2
When I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student2 submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
@@ -114,28 +101,19 @@ Feature: In an assignment, teachers grade multiple students on one page
And I press "Save all quick grading changes"
And I should see "The grade changes were saved"
And I press "Continue"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should see "I'm the teacher first feedback"
And I should see "60.0"
And I follow "Grades" in the user menu
And I click on "Course 1" "link" in the "region-main" "region"
And I should see "1337"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as student2
And I should not see "I'm the teacher first feedback"
And I should not see "60.0"
And I follow "Grades" in the user menu
And I click on "Course 1" "link" in the "region-main" "region"
And I should not see "1337"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Hide User picture" "link"
And I click on "Hide Full name" "link"
@@ -153,19 +131,13 @@ Feature: In an assignment, teachers grade multiple students on one page
And I press "Save all quick grading changes"
And I should see "The grade changes were saved"
And I press "Continue"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should see "I'm the teacher first feedback"
And I should see "60.0"
And I follow "Grades" in the user menu
And I click on "Course 1" "link" in the "region-main" "region"
And I should see "1337"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as student2
And I should not see "I'm the teacher first feedback"
And I should not see "60.0"
And I follow "Grades" in the user menu
@@ -66,10 +66,7 @@ Feature: Assignments correctly add feedback to the grade report when workflow an
And I should see "Released" in the "I'm the student's first submission" "table_row"
And I set the field "Grading action" to "Reveal student identities"
And I press "Continue"
And I log out
And I am on the "C1" Course page logged in as student1
And I navigate to "User report" in the course gradebook
And I am on the "Course 1" "grades > User report > View" page logged in as "student1"
Then I should see "50"
And I should see "Great job! Lol, not really."
@@ -92,10 +89,7 @@ Feature: Assignments correctly add feedback to the grade report when workflow an
And I follow "Test assignment name"
And I navigate to "View all submissions" in current page administration
And I should see "Released" in the "Student 1" "table_row"
And I log out
And I am on the "C1" Course page logged in as student1
And I navigate to "User report" in the course gradebook
And I am on the "Course 1" "grades > User report > View" page logged in as "student1"
Then I should see "50"
And I should see "Great job! Lol, not really."
@@ -350,7 +350,7 @@ class discussion_list extends db_table_vault {
$favouritesort .= ", {$favalias}.itemtype DESC";
}
return "{$alias}.pinned DESC $favouritesort , {$keyfield} {$direction}";
return "{$alias}.pinned DESC $favouritesort , {$keyfield} {$direction}, {$alias}.id {$direction}";
}
/**
+4
View File
@@ -187,6 +187,10 @@ echo $OUTPUT->header();
echo $OUTPUT->heading($pagetitle);
// It is possible that the following fields have been provided in the URL.
$userids = array_filter($userids, static function(int $userid) use ($course, $cm): bool {
$user = core_user::get_user($userid, '*', MUST_EXIST);
return $cm->effectivegroupmode != SEPARATEGROUPS || user_can_view_profile($user, $course);
});
$form->set_data(['useridsselected' => $userids, 'discussionids' => $discussionids, 'from' => $from, 'to' => $to]);
$form->display();
@@ -568,7 +568,22 @@ class summary_table extends table_sql {
$privaterepliesparams['privatereplyfrom'] = $USER->id;
}
list($enrolleduserssql, $enrolledusersparams) = get_enrolled_sql($this->get_context());
if ($this->iscoursereport) {
$course = get_course($this->courseid);
$groupmode = groups_get_course_groupmode($course);
} else {
$cm = \cm_info::create($this->cms[0]);
$groupmode = $cm->effectivegroupmode;
}
if ($groupmode == SEPARATEGROUPS && !has_capability('moodle/site:accessallgroups', $this->get_context())) {
$groups = groups_get_all_groups($this->courseid, $USER->id, 0, 'g.id');
$groupids = array_column($groups, 'id');
} else {
$groupids = [];
}
[$enrolleduserssql, $enrolledusersparams] = get_enrolled_sql($this->get_context(), '', $groupids);
$this->sql->params += $enrolledusersparams;
$queryattachments = 'SELECT COUNT(fi.id) AS attcount, fi.itemid AS postid, fi.userid
+11 -21
View File
@@ -11,8 +11,8 @@ Feature: The forum search allows users to perform advanced searches for forum po
| teacher2 | Teacher | TWO | teacher2@example.com | T1 |
| student1 | Student | 1 | student1@example.com | S1 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| fullname | shortname | category | newsitems |
| Course 1 | C1 | 0 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
@@ -24,17 +24,10 @@ Feature: The forum search allows users to perform advanced searches for forum po
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| news_items | Course | C1 | course-view-* | side-pre |
And I am on the "Course 1" "course editing" page logged in as teacher1
And I expand all fieldsets
And I set the field "id_newsitems" to "1"
And I press "Save and display"
And I add a new topic to "Announcements" forum with:
| Subject | My subject |
| Message | My message |
And I am on "Course 1" course homepage
And I add a new topic to "Announcements" forum with:
| Subject | Your subjective|
| Message | Your long message |
And the following "mod_forum > discussions" exist:
| user | forum | name | subject | message |
| teacher1 | Announcements | My subject | My subject | My message |
| teacher1 | Announcements | Your subjective | Your subjective | Your long message |
Scenario: Perform an advanced search using any term
Given I am on the "Announcements" "forum activity" page logged in as student1
@@ -77,14 +70,11 @@ Feature: The forum search allows users to perform advanced searches for forum po
And I should see "Your subjective"
Scenario: Perform an advanced search matching the author
Given I log in as "teacher2"
And I am on "Course 1" course homepage
And I add a new topic to "Announcements" forum with:
| Subject | My Subjects |
| Message | My message |
And I log out
When I am on the "Announcements" "forum activity" page logged in as student1
And I press "Search forums"
Given the following "mod_forum > discussions" exist:
| user | forum | name | subject | message |
| teacher2 | Announcements | My Subjects | My Subjects | My message |
And I am on the "Announcements" "forum activity" page logged in as student1
When I press "Search forums"
And I should see "Advanced search"
And I set the field "user" to "TWO"
And I press "Search forums"
@@ -51,6 +51,11 @@ Feature: A user can navigate to previous and next discussions
And I follow "Reply"
And I set the following fields to these values:
| Message | Answer to discussion |
# We need to wait a bit to guarantee that the post is created after the previous ones.
# because there is a bug in the forum_get_discussion_neighbours() when all the discussion
# last modified times are the same. See MDL-79247 for more details. Once that bug is fixed
# we can remove this wait.
And I wait "1" seconds
And I press "Post to forum"
And I should not see "Discussion 2"
And I should see "Discussion 3"
@@ -47,19 +47,13 @@ class behat_mod_forum_generator extends behat_generator_base {
}
/**
* Get the forum id using an activity idnumber.
* Get the forum id using an activity idnumber or name.
*
* @param string $idnumber
* @param string $idnumberorname The forum activity idnumber or name.
* @return int The forum id
*/
protected function get_forum_id(string $idnumber): int {
global $DB;
if (!$id = $DB->get_field('course_modules', 'instance', ['idnumber' => $idnumber])) {
throw new Exception('The specified activity with idnumber "' . $idnumber . '" could not be found.');
}
return $id;
protected function get_forum_id(string $idnumberorname): int {
return $this->get_cm_by_activity_name('forum', $idnumberorname)->instance;
}
/**
@@ -0,0 +1,38 @@
@mod @mod_glossary
Feature: Create a glossary entry.
In order to create glossary entries
As a user
I should be able to enter an entry without using reserved keywords
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | glossary |
| course | C1 |
| name | Test glossary |
@javascript @_file_upload
Scenario: Create glossary entry with attached file
Given I am on the "Test glossary" "glossary activity" page logged in as student1
# As a student, add a glossary entry with attachment
And I press "Add a new entry"
And I set the following fields to these values:
| Concept | Entry 1 |
| Definition | Definition of Entry 1 |
| Attachment | mod/glossary/tests/fixtures/musicians.xml |
And I press "Save changes"
# Confirm you can download attachment from student's entry as teacher
When I am on the "Test glossary" "glossary activity" page logged in as teacher1
Then I should see "Entry 1"
And I should see "musicians.xml"
And following "musicians.xml" should download between "1" and "3000" bytes
@@ -41,7 +41,6 @@ Feature: Do a H5P attempt
And I click on "Correct one" "text" in the ".h5p-question-content" "css_element"
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
And I switch to the main frame
And I log out
And I am on the "Course 1" course page logged in as teacher1
And I navigate to course participants
And I follow "Student 1"
@@ -83,8 +82,7 @@ Feature: Do a H5P attempt
And "2" row "Score" column of "table" table should contain "1"
And "3" row "Score" column of "table" table should contain "0"
And "4" row "Score" column of "table" table should contain "1"
And I am on the "Course 1" course page logged in as teacher1
And I navigate to "View > User report" in the course gradebook
And I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"
And I set the field "Select all or one user" to "Student 1"
Then the following should exist in the "user-grade" table:
| Grade item | Grade | Percentage |
+1 -1
View File
@@ -391,7 +391,7 @@ function imscp_export_contents($cm, $baseurl) {
$structure['fileurl'] = null;
$structure['timecreated'] = $imscp->timemodified;
$structure['timemodified'] = $imscp->timemodified;
$structure['content'] = json_encode(unserialize($imscp->structure));
$structure['content'] = json_encode(unserialize_array($imscp->structure));
$structure['sortorder'] = 0;
$structure['userid'] = null;
$structure['author'] = null;
+1 -7
View File
@@ -38,12 +38,7 @@ require_once("$CFG->libdir/resourcelib.php");
function imscp_print_content($imscp, $cm, $course) {
global $PAGE, $CFG;
$items = unserialize($imscp->structure);
$first = reset($items);
$context = context_module::instance($cm->id);
$urlbase = "$CFG->wwwroot/pluginfile.php";
$path = '/'.$context->id.'/mod_imscp/content/'.$imscp->revision.'/'.$first['href'];
$firsturl = file_encode_url($urlbase, $path, false);
$items = array_filter((array) unserialize_array($imscp->structure));
echo '<div id="imscp_layout">';
echo '<div id="imscp_toc">';
@@ -60,7 +55,6 @@ function imscp_print_content($imscp, $cm, $course) {
echo '</div>';
$PAGE->requires->js_init_call('M.mod_imscp.init');
return;
}
/**
+5 -5
View File
@@ -323,7 +323,7 @@ function lesson_grade($lesson, $ntries, $userid = 0) {
$attempt = end($attempts);
// If essay question, handle it, otherwise add to score
if ($page->requires_manual_grading()) {
$useranswerobj = unserialize($attempt->useranswer);
$useranswerobj = unserialize_object($attempt->useranswer);
if (isset($useranswerobj->score)) {
$earned += $useranswerobj->score;
}
@@ -2914,11 +2914,11 @@ class lesson extends lesson_base {
if ($dependentlesson = $DB->get_record('lesson', array('id' => $this->properties->dependency))) {
// Lesson exists, so we can proceed.
$conditions = unserialize($this->properties->conditions);
$conditions = unserialize_object($this->properties->conditions);
// Assume false for all.
$errors = array();
// Check for the timespent condition.
if ($conditions->timespent) {
if (!empty($conditions->timespent)) {
$timespent = false;
if ($attempttimes = $DB->get_records('lesson_timer', array("userid" => $USER->id, "lessonid" => $dependentlesson->id))) {
// Go through all the times and test to see if any of them satisfy the condition.
@@ -2934,7 +2934,7 @@ class lesson extends lesson_base {
}
}
// Check for the gradebetterthan condition.
if ($conditions->gradebetterthan) {
if (!empty($conditions->gradebetterthan)) {
$gradebetterthan = false;
if ($studentgrades = $DB->get_records('lesson_grades', array("userid" => $USER->id, "lessonid" => $dependentlesson->id))) {
// Go through all the grades and test to see if any of them satisfy the condition.
@@ -2949,7 +2949,7 @@ class lesson extends lesson_base {
}
}
// Check for the completed condition.
if ($conditions->completed) {
if (!empty($conditions->completed)) {
if (!$DB->count_records('lesson_grades', array('userid' => $USER->id, 'lessonid' => $dependentlesson->id))) {
$errors[] = get_string('completederror', 'lesson');
}
+4 -4
View File
@@ -358,10 +358,10 @@ class mod_lesson_mod_form extends moodleform_mod {
**/
public function data_preprocessing(&$defaultvalues) {
if (isset($defaultvalues['conditions'])) {
$conditions = unserialize($defaultvalues['conditions']);
$defaultvalues['timespent'] = $conditions->timespent;
$defaultvalues['completed'] = $conditions->completed;
$defaultvalues['gradebetterthan'] = $conditions->gradebetterthan;
$conditions = unserialize_object($defaultvalues['conditions']);
$defaultvalues['timespent'] = $conditions->timespent ?? 0;
$defaultvalues['completed'] = !empty($conditions->completed);
$defaultvalues['gradebetterthan'] = $conditions->gradebetterthan ?? 0;
}
// Set up the completion checkbox which is not part of standard data.
+3 -3
View File
@@ -56,9 +56,9 @@ class lesson_page_type_essay extends lesson_page {
* @return object
*/
static public function extract_useranswer($useranswer) {
$essayinfo = unserialize($useranswer);
$essayinfo = unserialize_object($useranswer);
if (!isset($essayinfo->responseformat)) {
$essayinfo->response = text_to_html($essayinfo->response, false, false);
$essayinfo->response = text_to_html($essayinfo->response ?? '', false, false);
$essayinfo->responseformat = FORMAT_HTML;
}
return $essayinfo;
@@ -150,7 +150,7 @@ class lesson_page_type_essay extends lesson_page {
$editoroptions['context'], 'mod_lesson', 'essay_answers', $attempt->id);
// Update the student response to have the modified link.
$useranswer = unserialize($attempt->useranswer);
$useranswer = unserialize_object($attempt->useranswer);
$useranswer->answer = $formdata->answer;
$useranswer->answerformat = $formdata->answerformat;
$attempt->useranswer = serialize($useranswer);
@@ -0,0 +1,52 @@
@mod @mod_lesson
Feature: Lesson activity access can be restricted
In order to restrict access to lesson activity
As a teacher
I need to set the lesson activity restriction
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
| Group 2 | C1 | G2 |
And the following "group members" exist:
| user | group |
| student1 | G1 |
| student2 | G2 |
And the following "activities" exist:
| activity | name | course | groupmode |
| lesson | Test lesson | C1 | 1 |
@javascript
Scenario Outline: Restrict lesson activity access by group
# Set lesson activity access by group
# Restrict lesson activity access by group as teacher
Given I am on the "Test lesson" "lesson activity editing" page logged in as teacher1
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue"
# Set only Group 1 can access activity
And I set the field "Group" in the "Restrict access" "fieldset" to "Group 1"
And I click on "Displayed greyed-out if user does not meet this condition" "button"
And I press "Save and return to course"
# Confirm that student1 can see lesson but student2 can't
When I am on the "Course 1" course page logged in as <user>
Then I <visibility> "Test lesson" in the "region-main" "region"
Examples:
| user | visibility |
| student1 | should see |
| student2 | should not see |
@@ -30,8 +30,7 @@ Feature: View activity completion information in the LTI activity
Given I am on the "Music history" "lti activity" page logged in as student1
And the "View" completion condition of "Music history" is displayed as "done"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
And I am on the "Course 1" course page logged in as teacher1
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
And I give the grade "90.00" to the user "Vinnie Student1" for the grade item "Music history"
And I press "Save changes"
@@ -0,0 +1,72 @@
@mod @mod_quiz
Feature: Flag quiz questions
As a student
In order to flag a quiz questions
All review options for immediately after the attempt are ticked
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@email.com |
| teacher1 | Teacher | 1 | teacher1@email.com |
And the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| teacher1 | C1 | teacher |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | questiontext |
| Test questions | truefalse | TF1 | First question |
| Test questions | truefalse | TF2 | Second question |
| Test questions | truefalse | TF3 | Third question |
And the following "activity" exists:
| activity | quiz |
| name | Quiz 1 |
| course | C1 |
| attemptimmediately | 1 |
| correctnessimmediately | 1 |
| maxmarksimmediately | 1 |
| marksimmediately | 1 |
| specificfeedbackimmediately | 1 |
| generalfeedbackimmediately | 1 |
| rightanswerimmediately | 1 |
| overallfeedbackimmediately | 1 |
And quiz "Quiz 1" contains the following questions:
| question | page |
| TF1 | 1 |
| TF2 | 2 |
| TF3 | 3 |
@javascript
Scenario: Flag a quiz during and after quiz attempt
Given I am on the "Quiz 1" "quiz activity" page logged in as student1
And I press "Attempt quiz"
# flag question 1
When I press "Flag question"
# Confirm question 1 is flagged in navigation
Then "Question 1 This page Flagged" "link" should exist
# Confirm that link in question 1 is changed to Remove flag
And I should see "Remove flag" in the "First question" "question"
# Answer questions
And I click on "True" "radio" in the "First question" "question"
And I press "Next page"
And I click on "True" "radio" in the "Second question" "question"
And I press "Next page"
And I click on "True" "radio" in the "Third question" "question"
And I follow "Finish attempt ..."
And I press "Submit all and finish"
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
# Confirm only flagged question is flagged
And I should see "Remove flag" in the "First question" "question"
And I should see "Flag question" in the "Second question" "question"
And I should see "Flag question" in the "Third question" "question"
And I click on "Flagged" "button" in the "Second question" "question"
And I am on the "Quiz 1" "mod_quiz > Grades report" page logged in as teacher1
And "Flagged" "icon" should exist in the "Student 1" "table_row"
And I am on the "Quiz 1" "mod_quiz > Responses report" page
And "Flagged" "icon" should exist in the "Student 1" "table_row"

Some files were not shown because too many files have changed in this diff Show More