diff --git a/mod/assign/db/upgrade.php b/mod/assign/db/upgrade.php index d3c6c4eb802..b80a60eb74a 100644 --- a/mod/assign/db/upgrade.php +++ b/mod/assign/db/upgrade.php @@ -64,13 +64,14 @@ function xmldb_assign_upgrade($oldversion) { // Assign savepoint reached. upgrade_mod_savepoint(true, 2012071800, 'assign'); } + if ($oldversion < 2012081600) { - // Define field sendlatenotifications to be added to assign + // Define field sendlatenotifications to be added to assign. $table = new xmldb_table('assign'); $field = new xmldb_field('completionsubmit', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'timemodified'); - // Conditionally launch add field sendlatenotifications + // Conditionally launch add field sendlatenotifications. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } diff --git a/mod/assign/lib.php b/mod/assign/lib.php index a13ec62516a..18a1b11659c 100644 --- a/mod/assign/lib.php +++ b/mod/assign/lib.php @@ -949,18 +949,18 @@ function assign_user_outline($course, $user, $coursemodule, $assignment) { * @param bool $type Type of comparison (or/and; can be used as return value if no conditions) * @return bool True if completed, false if not, $type if conditions not set. */ -function assign_get_completion_state($course,$cm,$userid,$type) { +function assign_get_completion_state($course, $cm, $userid, $type) { global $CFG,$DB; require_once($CFG->dirroot . '/mod/assign/locallib.php'); $assign = new assign(null, $cm, $course); - // If completion option is enabled, evaluate it and return true/false - if($assign->get_instance()->completionsubmit) { + // If completion option is enabled, evaluate it and return true/false. + if ($assign->get_instance()->completionsubmit) { $submission = $DB->get_record('assign_submission', array('assignment'=>$assign->get_instance()->id, 'userid'=>$userid), '*', IGNORE_MISSING); return $submission && $submission->status == ASSIGN_SUBMISSION_STATUS_SUBMITTED; } else { - // Completion option is not enabled so just return $type + // Completion option is not enabled so just return $type. return $type; } }