Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
7f91fb03
Commit
7f91fb03
authored
Oct 26, 2017
by
Damyon Wiese
Browse files
Merge branch 'MDL-60366_feedback_upgrade' of
git://github.com/davosmith/moodle
parents
fd39db29
5ef66eaf
Changes
1
Hide whitespace changes
Inline
Side-by-side
mod/feedback/db/upgrade.php
View file @
7f91fb03
...
...
@@ -146,17 +146,20 @@ function xmldb_feedback_upgrade($oldversion) {
// Related values in feedback_value won't be deleted (they won't be used and can be kept there as a backup).
$sql
=
"SELECT MAX(id) as maxid, userid, feedback, courseid
FROM
{
feedback_completed
}
WHERE userid <> 0
WHERE userid <> 0
AND anonymous_response = :notanonymous
GROUP BY userid, feedback, courseid
HAVING COUNT(id) > 1"
;
$params
=
[
'notanonymous'
=>
2
];
// FEEDBACK_ANONYMOUS_NO.
$duplicatedrows
=
$DB
->
get_recordset_sql
(
$sql
);
$duplicatedrows
=
$DB
->
get_recordset_sql
(
$sql
,
$params
);
foreach
(
$duplicatedrows
as
$row
)
{
$DB
->
delete_records_select
(
'feedback_completed'
,
'userid = ? AND feedback = ? AND courseid = ? AND id <> ?'
,
array
(
$row
->
userid
,
$row
->
feedback
,
$row
->
courseid
,
$row
->
maxid
,
$DB
->
delete_records_select
(
'feedback_completed'
,
'userid = ? AND feedback = ? AND courseid = ? AND id <> ?'
.
' AND anonymous_response = ?'
,
array
(
$row
->
userid
,
$row
->
feedback
,
$row
->
courseid
,
$row
->
maxid
,
2
,
// FEEDBACK_ANONYMOUS_NO.
));
}
$duplicatedrows
->
close
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment