Permalink
Browse files

MDL-36509: Assignment grading table rownum offset is wrong by one.

  • Loading branch information...
1 parent 03d9c19 commit dc99b426e9dac715f2b83e4cce1af3e00e0c0ded Damyon Wiese committed Nov 13, 2012
Showing with 17 additions and 6 deletions.
  1. +17 −6 mod/assign/gradingtable.php
@@ -209,6 +209,22 @@ function __construct(assign $assignment, $perpage, $filter, $rowoffset, $quickgr
}
/**
+ * Before adding each row to the table make sure rownum is incremented
+ *
+ * @param array $row row of data from db used to make one row of the table.
+ * @return array one row for the table
+ */
+ function format_row($row) {
+ if ($this->rownum < 0) {
+ $this->rownum = $this->currpage * $this->pagesize;
+ } else {
+ $this->rownum += 1;
+ }
+
+ return parent::format_row($row);
+ }
+
+ /**
* Add the userid to the row class so it can be updated via ajax
*
* @param stdClass $row The row of data
@@ -277,7 +293,7 @@ function col_outcomes(stdClass $row) {
/**
- * Format a user picture for display (and update rownum as a sideeffect)
+ * Format a user picture for display
*
* @param stdClass $row
* @return string
@@ -435,11 +451,6 @@ function col_status(stdClass $row) {
*/
function col_userid(stdClass $row) {
$edit = '';
- if ($this->rownum < 0) {
- $this->rownum = $this->currpage * $this->pagesize;
- } else {
- $this->rownum += 1;
- }
$actions = array();

0 comments on commit dc99b42

Please sign in to comment.