mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-15729 "detailled responses report not showing responses"
This commit is contained in:
parent
2c1363e622
commit
3e71541fde
@ -177,7 +177,7 @@ class quiz_responses_report extends quiz_default_report {
|
||||
|
||||
|
||||
// Construct the SQL
|
||||
$fields = $DB->sql_concat('u.id', '\'#\'', 'COALESCE(qa.attempt, \'0\')').' AS uniqueid, ';
|
||||
$fields = $DB->sql_concat('u.id', '\'#\'', 'COALESCE(qa.attempt, \'0\')').' AS concattedid, ';
|
||||
if ($qmsubselect) {
|
||||
$fields .=
|
||||
"(CASE " .
|
||||
@ -186,7 +186,7 @@ class quiz_responses_report extends quiz_default_report {
|
||||
"END) AS gradedattempt, ";
|
||||
}
|
||||
|
||||
$fields .='qa.uniqueid AS attemptuniqueid, qa.id AS attempt, u.id AS userid, u.idnumber, u.firstname,'.
|
||||
$fields .='qa.uniqueid, qa.id AS attempt, u.id AS userid, u.idnumber, u.firstname,'.
|
||||
' u.lastname, u.institution, u.department, u.email, u.picture, u.imagealt, '.
|
||||
'qa.sumgrades, qa.timefinish, qa.timestart, qa.timefinish - qa.timestart AS duration, ' .
|
||||
'qa.layout ';
|
||||
@ -303,7 +303,7 @@ class quiz_responses_report extends quiz_default_report {
|
||||
|
||||
$table->define_columns($columns);
|
||||
$table->define_headers($headers);
|
||||
$table->sortable(true, 'uniqueid');
|
||||
$table->sortable(true, 'concattedid');
|
||||
|
||||
// Set up the table
|
||||
$table->define_baseurl($reporturl->out(false, $displayoptions));
|
||||
|
@ -20,21 +20,10 @@ class quiz_report_responses_table extends table_sql {
|
||||
$this->displayoptions = $displayoptions;
|
||||
}
|
||||
function build_table(){
|
||||
global $CFG, $DB;
|
||||
if ($this->rawdata) {
|
||||
// Define some things we need later to process raw data from db.
|
||||
$this->strtimeformat = get_string('strftimedatetime');
|
||||
parent::build_table();
|
||||
//end of adding data from attempts data to table / download
|
||||
//now add averages at bottom of table :
|
||||
$params = array($this->quiz->id);
|
||||
|
||||
$this->add_separator();
|
||||
if ($this->is_downloading()){
|
||||
$namekey = 'lastname';
|
||||
} else {
|
||||
$namekey = 'fullname';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,26 +138,17 @@ class quiz_report_responses_table extends table_sql {
|
||||
}
|
||||
}
|
||||
function other_cols($colname, $attempt){
|
||||
static $gradedstatesbyattempt = null, $states =array();
|
||||
if ($gradedstatesbyattempt === null){
|
||||
//get all the attempt ids we want to display on this page
|
||||
//or to export for download.
|
||||
$attemptids = array();
|
||||
foreach ($this->rawdata as $attempt){
|
||||
if ($attempt->attemptuniqueid > 0){
|
||||
$attemptids[] = $attempt->attemptuniqueid;
|
||||
$states[$attempt->attemptuniqueid] = get_question_states($this->questions, $this->quiz, $attempt);
|
||||
}
|
||||
}
|
||||
$gradedstatesbyattempt = quiz_get_newgraded_states($attemptids, true, 'qs.id, qs.grade, qs.event, qs.question, qs.attempt');
|
||||
}
|
||||
static $states =array();
|
||||
if (preg_match('/^qsanswer([0-9]+)$/', $colname, $matches)){
|
||||
if ($attempt->uniqueid > 0 && !isset($states[$attempt->uniqueid])){
|
||||
$states[$attempt->uniqueid] = get_question_states($this->questions, $this->quiz, $attempt);
|
||||
}
|
||||
$statesforattempt = $states[$attempt->uniqueid];
|
||||
$questionid = $matches[1];
|
||||
$question = $this->questions[$questionid];
|
||||
$stateforqinattempt = $gradedstatesbyattempt[$attempt->attemptuniqueid][$questionid];
|
||||
$responses = get_question_actual_response($question, $states[$attempt->attemptuniqueid][$questionid]);
|
||||
$responses = get_question_actual_response($question, $statesforattempt[$questionid]);
|
||||
$response = (!empty($responses)? implode(', ',$responses) : '-');
|
||||
$grade = $stateforqinattempt->grade;
|
||||
$grade = $statesforattempt[$questionid]->last_graded->grade;
|
||||
if (!$this->is_downloading()) {
|
||||
$format_options = new stdClass;
|
||||
$format_options->para = false;
|
||||
@ -183,7 +163,7 @@ class quiz_report_responses_table extends table_sql {
|
||||
}
|
||||
return '<span class="'.$qclass.'">'.format_text($response, FORMAT_MOODLE, $format_options).'</span>';
|
||||
} else {
|
||||
return format_text($response, FORMAT_MOODLE, $format_options);
|
||||
return $response;
|
||||
}
|
||||
} else {
|
||||
return NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user