Permalink
Browse files

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

  • Loading branch information...
1 parent 9540a7d commit 61cf325300ef5b772ff756239191c5ea3255d585 Damyon Wiese committed Nov 13, 2012
Showing with 17 additions and 6 deletions.
  1. +17 −6 mod/assign/gradingtable.php
@@ -318,6 +318,22 @@ public function __construct(assign $assignment, $perpage, $filter, $rowoffset, $
}
/**
+ * 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 a column with an ID that uniquely identifies this user in this assignment
*
* @return string
@@ -491,7 +507,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
@@ -686,11 +702,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 61cf325

Please sign in to comment.