mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-55231 core_course: Partial course cache rebuild
This commit is contained in:
parent
e5894c0455
commit
9a900492bc
15 changed files with 406 additions and 177 deletions
|
@ -54,3 +54,64 @@ Feature: availability_completion
|
|||
# Mark page 1 complete
|
||||
When I toggle the manual completion state of "Page 1"
|
||||
Then I should see "Page 2" in the "region-main" "region"
|
||||
|
||||
@javascript
|
||||
Scenario: test completion and course cache rebuild
|
||||
Given the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| forum | forum 1 | forum 1 | C1 | forum1 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I open "forum 1" actions menu
|
||||
And I click on "Edit settings" "link" in the "forum 1" activity
|
||||
And I set the following fields to these values:
|
||||
| Completion tracking | Show activity as complete when conditions are met |
|
||||
| completionview | 1 |
|
||||
| completionpostsenabled | 1 |
|
||||
| completionposts | 2 |
|
||||
And I press "Save and return to course"
|
||||
|
||||
And I add a new discussion to "forum 1" forum with:
|
||||
| Subject | Forum post 1 |
|
||||
| Message | This is the body |
|
||||
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Page" to section "2"
|
||||
And I set the following fields to these values:
|
||||
| Name | Page 2 |
|
||||
| Description | Test |
|
||||
| Page content | Test |
|
||||
And I expand all fieldsets
|
||||
And I press "Add restriction..."
|
||||
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
||||
And I click on ".availability-item .availability-eye img" "css_element"
|
||||
And I set the following fields to these values:
|
||||
| Required completion status | must be marked complete |
|
||||
| cm | forum 1 |
|
||||
And I press "Save and return to course"
|
||||
|
||||
When I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
|
||||
# Page 2 should not appear yet.
|
||||
Then I should not see "Page 2" in the "region-main" "region"
|
||||
And I click on "forum 1" "link" in the "region-main" "region"
|
||||
# Page 2 should not appear yet.
|
||||
Then I should not see "Page 2" in the "region-main" "region"
|
||||
|
||||
When I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "forum 1" "forum activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| completionpostsenabled | 0 |
|
||||
And I press "Save and display"
|
||||
|
||||
When I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I click on "forum 1" "link" in the "region-main" "region"
|
||||
And I am on "Course 1" course homepage
|
||||
Then I should see "Page 2" in the "region-main" "region"
|
||||
|
|
|
@ -292,14 +292,15 @@ class condition extends \core_availability\condition {
|
|||
$updatesection->availability = json_encode($tree->save());
|
||||
$updatesection->timemodified = time();
|
||||
$DB->update_record('course_sections', $updatesection);
|
||||
course_purge_section_cache($section);
|
||||
|
||||
$anychanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure course cache is cleared if required.
|
||||
if ($anychanged) {
|
||||
rebuild_course_cache($courseid, true);
|
||||
// Partial rebuild the sections which have been invalidated.
|
||||
rebuild_course_cache($courseid, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue