Permalink
Browse files

Change to workshop_grades - only return grades when in the final phas…

…e (phase 6).
  • Loading branch information...
1 parent 0d4d32d commit 8dfe0fa64fbc324d88e4cdcdfecbd6c85a7eec61 rkingdon committed Oct 13, 2003
Showing with 13 additions and 8 deletions.
  1. +13 −8 mod/workshop/lib.php
View
@@ -554,16 +554,21 @@ function workshop_delete_instance($id) {
///////////////////////////////////////////////////////////////////////////////
function workshop_grades($workshopid) {
/// Must return an array of grades, indexed by user, and a max grade.
+/// only retruns grades in phase 6
global $CFG;
- if ($bestsubmissions = get_records_sql("SELECT userid, max(finalgrade) finalgrade FROM
- {$CFG->prefix}workshop_submissions WHERE workshopid = $workshopid GROUP
- BY userid")) {
- foreach ($bestsubmissions as $bestgrade) {
- $return->grades[$bestgrade->userid] = $bestgrade->finalgrade;
- }
- }
- $return->maxgrade = get_field("workshop", "grade", "id", "$workshopid");
+ if ($workshop = get_record("workshop", "id", $workshopid)) {
+ if ($workshop->phase == 6) {
+ if ($bestsubmissions = get_records_sql("SELECT userid, max(finalgrade) finalgrade FROM
+ {$CFG->prefix}workshop_submissions WHERE workshopid = $workshopid GROUP
+ BY userid")) {
+ foreach ($bestsubmissions as $bestgrade) {
+ $return->grades[$bestgrade->userid] = $bestgrade->finalgrade;
+ }
+ }
+ }
+ $return->maxgrade = $workshop->grade;
+ }
return $return;
}

0 comments on commit 8dfe0fa

Please sign in to comment.