Permalink
Browse files

Merge branch 'MDL-37039-23' of git://github.com/damyon/moodle into MO…

…ODLE_23_STABLE
  • Loading branch information...
2 parents ffad867 + e09f33d commit 731ff94a878298f615175ad203c4fd5d51e46788 @danpoltawski danpoltawski committed Feb 11, 2013
Showing with 16 additions and 13 deletions.
  1. +16 −13 mod/assign/gradingtable.php
@@ -101,19 +101,22 @@ function __construct(assign $assignment, $perpage, $filter, $rowoffset, $quickgr
$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);

0 comments on commit 731ff94

Please sign in to comment.