mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-67002' of https://github.com/timhunt/moodle into master
This commit is contained in:
commit
d40cecdb8a
@ -385,8 +385,13 @@ abstract class quiz_attempts_report_table extends table_sql {
|
||||
|
||||
/**
|
||||
* Get any fields that might be needed when sorting on date for a particular slot.
|
||||
*
|
||||
* Note: these values are only used for sorting. The values displayed are taken
|
||||
* from $this->lateststeps loaded in load_extra_data().
|
||||
*
|
||||
* @param int $slot the slot for the column we want.
|
||||
* @param string $alias the table alias for latest state information relating to that slot.
|
||||
* @return string definitions of extra fields to add to the SELECT list of the query.
|
||||
*/
|
||||
protected function get_required_latest_state_fields($slot, $alias) {
|
||||
return '';
|
||||
|
@ -114,14 +114,7 @@ class quiz_last_responses_table extends quiz_attempts_report_table {
|
||||
if (!isset($this->lateststeps[$attempt->usageid][$slot])) {
|
||||
return '-';
|
||||
}
|
||||
$stepdata = $this->lateststeps[$attempt->usageid][$slot];
|
||||
|
||||
if (property_exists($stepdata, $field . 'full')) {
|
||||
$value = $stepdata->{$field . 'full'};
|
||||
} else {
|
||||
$value = $stepdata->$field;
|
||||
}
|
||||
return $value;
|
||||
return $this->lateststeps[$attempt->usageid][$slot]->$field;
|
||||
}
|
||||
|
||||
public function other_cols($colname, $attempt) {
|
||||
@ -158,20 +151,8 @@ class quiz_last_responses_table extends quiz_attempts_report_table {
|
||||
*/
|
||||
protected function get_required_latest_state_fields($slot, $alias) {
|
||||
global $DB;
|
||||
$sortableresponse = $DB->sql_order_by_text("{$alias}.questionsummary");
|
||||
if ($sortableresponse === "{$alias}.questionsummary") {
|
||||
// Can just order by text columns. No complexity needed.
|
||||
return "{$alias}.questionsummary AS question{$slot},
|
||||
{$alias}.rightanswer AS right{$slot},
|
||||
{$alias}.responsesummary AS response{$slot}";
|
||||
} else {
|
||||
// Work-around required.
|
||||
return $DB->sql_order_by_text("{$alias}.questionsummary") . " AS question{$slot},
|
||||
{$alias}.questionsummary AS question{$slot}full,
|
||||
" . $DB->sql_order_by_text("{$alias}.rightanswer") . " AS right{$slot},
|
||||
{$alias}.rightanswer AS right{$slot}full,
|
||||
" . $DB->sql_order_by_text("{$alias}.responsesummary") . " AS response{$slot},
|
||||
{$alias}.responsesummary AS response{$slot}full";
|
||||
}
|
||||
return $DB->sql_order_by_text("{$alias}.questionsummary") . " AS question{$slot},
|
||||
" . $DB->sql_order_by_text("{$alias}.rightanswer") . " AS right{$slot},
|
||||
" . $DB->sql_order_by_text("{$alias}.responsesummary") . " AS response{$slot}";
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user