Skip to content

Commit

Permalink
MDL-46078 Assign: Completion is not using assignment API.
Browse files Browse the repository at this point in the history
Should not be directly querying the DB to get the submission, use the API!
  • Loading branch information
Damyon Wiese committed Jul 28, 2015
1 parent 9325cd9 commit 5ce0f74
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions mod/assign/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1309,8 +1309,7 @@ function assign_get_completion_state($course, $cm, $userid, $type) {

// If completion option is enabled, evaluate it and return true/false.
if ($assign->get_instance()->completionsubmit) {
$dbparams = array('assignment'=>$assign->get_instance()->id, 'userid'=>$userid);
$submission = $DB->get_record('assign_submission', $dbparams, '*', IGNORE_MISSING);
$submission = $assign->get_user_submission($userid, false);
return $submission && $submission->status == ASSIGN_SUBMISSION_STATUS_SUBMITTED;
} else {
// Completion option is not enabled so just return $type.
Expand Down

0 comments on commit 5ce0f74

Please sign in to comment.