Skip to content

Commit

Permalink
MDL-31341 mod_assign: fixup minor coding style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Aug 21, 2012
1 parent 94fb9f9 commit 3a66d42
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions mod/assign/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions mod/assign/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 3a66d42

Please sign in to comment.