Methods to get info about assessments and dimensions are part of strategy API

This commit is contained in:
David Mudrak 2010-01-04 18:16:41 +00:00
parent a880be9b14
commit 9df08ee894
4 changed files with 25 additions and 6 deletions

View File

@ -67,10 +67,10 @@ class workshop_best_evaluation implements workshop_evaluation {
}
// get the information about the assessment dimensions
$diminfo = $grader->eval_best_dimensions_info();
$diminfo = $grader->get_dimensions_info();
// fetch a recordset with all assessments to process
$rs = $grader->eval_best_get_assessments_recordset($restrict);
$rs = $grader->get_assessments_recordset($restrict);
$batch = array(); // will contain a set of all assessments of a single submission
$previous = null; // a previous record in the recordset
foreach ($rs as $current) {

View File

@ -270,7 +270,7 @@ class workshop_accumulative_strategy implements workshop_strategy {
* @param resource $restrict
* @return TODO
*/
public function eval_best_get_assessments_recordset($restrict) {
public function get_assessments_recordset($restrict) {
global $DB;
$sql = 'SELECT s.id AS submissionid,
@ -302,7 +302,7 @@ class workshop_accumulative_strategy implements workshop_strategy {
*
* @return array [dimid] => stdClass (->id ->max ->min ->weight)
*/
public function eval_best_dimensions_info() {
public function get_dimensions_info() {
global $DB;
$sql = 'SELECT d.id, d.grade, d.weight, s.scale

View File

@ -93,4 +93,23 @@ interface workshop_strategy {
*/
public function supports_evaluation(workshop_evaluation $evaluation);
/**
* Returns a general information about the assessment dimensions
*
* @return array [dimid] => stdClass (->id ->max ->min ->weight)
*/
public function get_dimensions_info();
/**
* Returns recordset with detailed information of all assessments done using this strategy
*
* The returned structure must be a recordset of objects containing at least properties:
* submissionid, assessmentid, assessmentweight, reviewerid, gradinggrade, dimensionid and grade.
* It is possible to pass user id(s) of reviewer(s). Then, the method returns just the reviewer's
* assessments info.
*
* @param array|int|null $restrict optional id or ids of the reviewer
* @return moodle_recordset
*/
public function get_assessments_recordset($restrict=null);
}

View File

@ -320,7 +320,7 @@ class workshop_rubric_strategy implements workshop_strategy {
* @param array|int|null $restrict optional id or ids of the reviewer
* @return moodle_recordset
*/
public function eval_best_get_assessments_recordset($restrict=null) {
public function get_assessments_recordset($restrict=null) {
global $DB;
$sql = 'SELECT s.id AS submissionid,
@ -354,7 +354,7 @@ class workshop_rubric_strategy implements workshop_strategy {
*
* @return array [dimid] => stdClass (->id ->max ->min ->weight)
*/
public function eval_best_dimensions_info() {
public function get_dimensions_info() {
global $DB;
$sql = 'SELECT d.id AS id, MIN(l.grade) AS min, MAX(l.grade) AS max, 1 AS weight