Skip to content

Commit

Permalink
Merge branch 'MDL-37039-master' of git://github.com/damyon/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Feb 11, 2013
2 parents 2ae00d0 + 93d1de6 commit 9d7d0c4
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions mod/assign/gradingtable.php
Expand Up @@ -140,19 +140,22 @@ public function __construct(assign $assignment,
$where = 'u.id ' . $userwhere;
$params = array_merge($params, $userparams);

if ($filter == ASSIGN_FILTER_SUBMITTED) {
$where .= ' AND s.timecreated > 0 ';
}
if ($filter == ASSIGN_FILTER_REQUIRE_GRADING) {
$where .= ' AND (s.timemodified IS NOT NULL AND
s.status = :submitted AND
(s.timemodified > g.timemodified OR g.timemodified IS NULL))';
$params['submitted'] = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
}
if (strpos($filter, ASSIGN_FILTER_SINGLE_USER) === 0) {
$userfilter = (int) array_pop(explode('=', $filter));
$where .= ' AND (u.id = :userid)';
$params['userid'] = $userfilter;
// The filters do not make sense when there are no submissions, so do not apply them.
if ($this->assignment->is_any_submission_plugin_enabled()) {
if ($filter == ASSIGN_FILTER_SUBMITTED) {
$where .= ' AND s.timecreated > 0 ';
}
if ($filter == ASSIGN_FILTER_REQUIRE_GRADING) {
$where .= ' AND (s.timemodified IS NOT NULL AND
s.status = :submitted AND
(s.timemodified > g.timemodified OR g.timemodified IS NULL))';
$params['submitted'] = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
}
if (strpos($filter, ASSIGN_FILTER_SINGLE_USER) === 0) {
$userfilter = (int) array_pop(explode('=', $filter));
$where .= ' AND (u.id = :userid)';
$params['userid'] = $userfilter;
}
}
$this->set_sql($fields, $from, $where, $params);

Expand Down

0 comments on commit 9d7d0c4

Please sign in to comment.