Skip to content

Commit

Permalink
Set unknown completion state only for automatic tracking
Browse files Browse the repository at this point in the history
The completion state COMPLETION_UNKNOWN is only applicable with
automatic completion tracking. With manual tracking the only possible
options are COMPLETION_INCOMPLETE or COMPLETION_COMPLETE. Therefore,
we don’t change the completion state at all during the different
phases when tracking the completion manually.

Fixes: #306
  • Loading branch information
Lars Thoms authored and dlmsr committed Jan 24, 2025
1 parent fa80ccf commit b894dd2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ private function process_action_start_distribution() {
}
$raters = $this->get_raters_in_course();
$completion = new completion_info($this->course);
if ($completion->is_enabled($this->coursemodule)) {
if ($completion->is_enabled($this->coursemodule) == COMPLETION_TRACKING_AUTOMATIC) {
foreach ($raters as $rater) {
$completion->update_state($this->coursemodule, COMPLETION_UNKNOWN, $rater->id);
}
Expand Down Expand Up @@ -745,7 +745,7 @@ private function process_action_manual_allocation() {
}
$raters = $this->get_raters_in_course();
$completion = new completion_info($this->course);
if ($completion->is_enabled($this->coursemodule)) {
if ($completion->is_enabled($this->coursemodule) == COMPLETION_TRACKING_AUTOMATIC) {
foreach ($raters as $rater) {
$completion->update_state($this->coursemodule, COMPLETION_UNKNOWN, $rater->id);
}
Expand Down Expand Up @@ -1045,7 +1045,7 @@ public function distribute_users_without_choice(string $distributionalgorithm):
$transaction->allow_commit();

$completion = new completion_info($this->course);
if ($completion->is_enabled($this->coursemodule)) {
if ($completion->is_enabled($this->coursemodule) == COMPLETION_TRACKING_AUTOMATIC) {
foreach ($possibleusers as $userid) {
$completion->update_state($this->coursemodule, COMPLETION_UNKNOWN, $userid);
}
Expand Down Expand Up @@ -1445,7 +1445,7 @@ public function distrubute_choices() {

$completion = new completion_info($this->course);
$raters = $this->get_raters_in_course();
if ($completion->is_enabled($this->coursemodule)) {
if ($completion->is_enabled($this->coursemodule) == COMPLETION_TRACKING_AUTOMATIC) {
foreach ($raters as $rater) {
$completion->update_state($this->coursemodule, COMPLETION_UNKNOWN, $rater->id);
}
Expand Down Expand Up @@ -1956,7 +1956,7 @@ public function save_ratings_to_db($userid, array $data) {
$transaction->allow_commit();

$completion = new completion_info($this->course);
if ($completion->is_enabled()) {
if ($completion->is_enabled() == COMPLETION_TRACKING_AUTOMATIC) {
$completion->set_module_viewed($this->coursemodule, $userid);
$completion->update_state($this->coursemodule, COMPLETION_UNKNOWN, $userid);
}
Expand Down Expand Up @@ -2099,7 +2099,7 @@ public function save_manual_allocation_form($allocdata, $userdata) {
$transaction->allow_commit();

$completion = new completion_info($this->course);
if ($completion->is_enabled($this->coursemodule)) {
if ($completion->is_enabled($this->coursemodule) == COMPLETION_TRACKING_AUTOMATIC) {
foreach ($allusers as $rater) {
$completion->update_state($this->coursemodule, COMPLETION_UNKNOWN, $rater->id);
}
Expand Down

0 comments on commit b894dd2

Please sign in to comment.