Skip to content

Commit

Permalink
Merge branch 'MDL-53864_master-alt' of git://github.com/markn86/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Apr 25, 2016
2 parents f60e024 + 4aa7e3f commit 32bdfd7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mod/feedback/analysis_course.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@
}

if ($courseitemfilter > 0) {
$avgvalue = 'avg(' . $DB->sql_cast_char2int('value', true) . ')';
$sql = "SELECT fv.course_id, c.shortname, $avgvalue AS avgvalue
$sumvalue = 'SUM(' . $DB->sql_cast_char2real('value', true) . ')';
$sql = "SELECT fv.course_id, c.shortname, $sumvalue AS sumvalue, COUNT(value) as countvalue
FROM {feedback_value} fv, {course} c, {feedback_item} fi
WHERE fv.course_id = c.id AND fi.id = fv.item AND fi.typ = ? AND fv.item = ?
GROUP BY course_id, shortname
ORDER BY avgvalue desc";
ORDER BY sumvalue desc";

if ($courses = $DB->get_records_sql($sql, array($courseitemfiltertyp, $courseitemfilter))) {
$item = $DB->get_record('feedback_item', array('id'=>$courseitemfilter));
Expand All @@ -133,7 +133,7 @@
echo '<tr>';
echo '<td>'.$shortname.'</td>';
echo '<td align="right">';
echo number_format(($c->avgvalue), 2, $sep_dec, $sep_thous);
echo number_format(($c->sumvalue / $c->countvalue), 2, $sep_dec, $sep_thous);
echo '</td>';
echo '</tr>';
}
Expand Down

0 comments on commit 32bdfd7

Please sign in to comment.