Skip to content

Commit

Permalink
CTP-4110 Fix finalise submissions after deadline
Browse files Browse the repository at this point in the history
When the coursework deadline has passed submissions are finalised in
the database, however the previous cached value was shown to teachers.
We now clear this cache after updating the database.

Behat test submissions_auto_finalisation.feature has been updated to
additionally test for this by viewing view.php before the deadline has
passed to populate the cache, then reloading after finalising
submissions, checking for the expected status.
  • Loading branch information
leonstr committed Jan 7, 2025
1 parent 92fd479 commit 24b00d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions classes/models/coursework.php
Original file line number Diff line number Diff line change
Expand Up @@ -2463,6 +2463,7 @@ public function finalise_all() {
$DB->execute("UPDATE {coursework_submissions}
SET finalised = 1
WHERE courseworkid = ? $excludesql", [$this->id]);
\mod_coursework\models\submission::remove_cache($this->id);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion tests/behat/submissions_auto_finalisation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ Feature: Auto finalising before cron runs

Scenario: Teacher visits the page and sees the submission is finalised when the deadline has passed
Given I am logged in as a teacher
And I visit the coursework page
And the coursework deadline has passed
When I visit the coursework page
When I reload the page
Then I should see "Ready to grade"

Scenario: Teacher visits the page and sees the submission is not finalised when the deadline has not passed
Expand Down

0 comments on commit 24b00d8

Please sign in to comment.