/** * This function tests to see if individual student scores can be retrieved. * */ public function test_get_table_rows() { $this->configure_settings(); $this->allow_group_join(); $gr = new group_records($this->courseid); $rows = $gr->get_table_rows(); // Group 1 scores 9's across the board (avg -> 4.5), while Group 2 scores 5's across the board (avg -> 2.5). $testscores = array('SS', 'SS'); $i = 0; foreach ($rows as $row) { $this->assertEquals($row['id'], $this->groupids[$i]); for ($j = 0; $j < self::FEEDBACKITEMS; $j++) { $this->assertEquals($row[$j], $testscores[$i]); } $i++; } }
/** * This is function grabs the records from a particular folder, encodes them in json, and writes * the records to the page. * */ private function get_group_stats() { global $USER; $this->courseid = required_param('courseid', PARAM_INT); $gr = new group_records($this->courseid); $tablerows = $gr->get_table_rows(); $skillslist = $gr->get_skills_list(); $table = array('skills' => $skillslist, 'rows' => $tablerows); echo json_encode($table); }