$result = $Conf->qe($q . " where {$notdropped}"); $series = new Series(); $xseries = new Series(); while ($row = edb_row($result)) { if ($g = ContactView::pset_grade(json_decode($row[0]), $Pset)) { $series->add($g->total); if ($row[1]) { $xseries->add($g->total); } } } $r = $series->summary(); if ($xseries->n) { $r->extension = $xseries->summary(); } $pgj = ContactView::pset_grade_json($Pset, false); if ($pgj && isset($pgj->maxgrades->total)) { $r->maxtotal = $pgj->maxgrades->total; } $Conf->save_setting("gradejson_pset{$Pset->id}", $Now, json_encode($r)); } $j = json_decode($Conf->setting_data("gradejson_pset{$Pset->id}")); $j->ok = true; if (!$Pset->separate_extension_grades || !$User->extension) { unset($j->extension); } if ($User == $Me && $Pset->grade_cdf_cutoff) { Series::truncate_summary_below($j, $Pset->grade_cdf_cutoff); if (@$j->extension) { Series::truncate_summary_below($j->extension, $Pset->grade_cdf_cutoff); }