Skip to content

Commit

Permalink
MDL-37039 Assignment - Do not apply filters to grading table for offl…
Browse files Browse the repository at this point in the history
…ine assignments

Because the filters do not make sense for offline assignments, they are hidden. But if the active filter
prevents you from seeing any assignments you cannot change it. This change makes it so the filters are
also not applied when the assignment is an offline assignment.
  • Loading branch information
Damyon Wiese committed Feb 8, 2013
1 parent bb4c391 commit 93d1de6
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions mod/assign/gradingtable.php
Original file line number Diff line number Diff line change
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 93d1de6

Please sign in to comment.