This commit is contained in:
Jun Pataleta 2023-03-10 09:19:55 +08:00
commit 7063f9c17f
2 changed files with 10 additions and 2 deletions

View File

@ -289,6 +289,8 @@ class mod_feedback_responses_table extends table_sql {
* are only needed when outputting or downloading data.
*/
protected function add_all_values_to_output() {
global $DB;
$tablecolumns = array_keys($this->columns);
$tableheaders = $this->headers;
@ -308,7 +310,7 @@ class mod_feedback_responses_table extends table_sql {
if ($columnscount++ < self::TABLEJOINLIMIT) {
// Mysql has a limit on the number of tables in the join, so we only add limited number of columns here,
// the rest will be added in {@link self::build_table()} and {@link self::build_table_chunk()} functions.
$this->sql->fields .= ", v{$nr}.value AS val{$nr}";
$this->sql->fields .= ", " . $DB->sql_cast_to_char("v{$nr}.value") . " AS val{$nr}";
$this->sql->from .= " LEFT OUTER JOIN {feedback_value} v{$nr} " .
"ON v{$nr}.completed = c.id AND v{$nr}.item = :itemid{$nr}";
$this->sql->params["itemid{$nr}"] = $item->id;
@ -560,7 +562,7 @@ class mod_feedback_responses_table extends table_sql {
$from = '{feedback_completed} c';
$params = [];
foreach ($columnsgroup as $nr => $item) {
$fields .= ", v{$nr}.value AS val{$nr}";
$fields .= ", " . $DB->sql_cast_to_char("v{$nr}.value") . " AS val{$nr}";
$from .= " LEFT OUTER JOIN {feedback_value} v{$nr} " .
"ON v{$nr}.completed = c.id AND v{$nr}.item = :itemid{$nr}";
$params["itemid{$nr}"] = $item->id;

View File

@ -140,6 +140,12 @@ Feature: Non anonymous feedback
And I should not see "Next"
And I should see "Prev"
And I click on "Back" "link" in the "region-main" "region"
# Sort the feedback responses.
And I click on "Do you like this course?" "link" in the "generaltable" "table"
And "Username 1" "table_row" should appear before "Username 2" "table_row"
# Now sort descending.
And I click on "Do you like this course?" "link" in the "generaltable" "table"
And "Username 2" "table_row" should appear before "Username 1" "table_row"
# Delete non anonymous response
And I click on "Delete entry" "link" in the "Username 1" "table_row"
And I press "Yes"