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

This commit is contained in:
Damyon Wiese
2012-11-13 09:58:08 +08:00
parent 9540a7d0b8
commit 61cf325300
+17 -6
View File
@@ -317,6 +317,22 @@ class assign_grading_table extends table_sql implements renderable {
}
}
/**
* 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
*
@@ -491,7 +507,7 @@ class assign_grading_table extends table_sql implements renderable {
/**
* 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 @@ class assign_grading_table extends table_sql implements renderable {
*/
function col_userid(stdClass $row) {
$edit = '';
if ($this->rownum < 0) {
$this->rownum = $this->currpage * $this->pagesize;
} else {
$this->rownum += 1;
}
$actions = array();