Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix case when groups are mixed case #348 #351

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,16 +504,22 @@ function xmldb_tool_excimer_upgrade($oldversion) {
$dbman->change_field_precision($table, $field);

// Find all non-unique page groups and remove duplicates.
$sql = "
SELECT pgroups.id, pgroups.name, pgroups.month, pgroups.fuzzycount
FROM {tool_excimer_page_groups} pgroups
JOIN (
SELECT name, month
FROM {tool_excimer_page_groups}
GROUP BY name, month
HAVING COUNT(*) > 1
) dupl ON pgroups.name = dupl.name AND pgroups.month = dupl.month
ORDER BY pgroups.name, pgroups.month, pgroups.fuzzycount DESC
$sql = " SELECT pgroups.id,
LOWER(pgroups.name) name,
pgroups.month,
pgroups.fuzzycount
FROM {tool_excimer_page_groups} pgroups
JOIN (
SELECT LOWER(name) name,
month
FROM {tool_excimer_page_groups}
GROUP BY LOWER(name),
month
HAVING COUNT(*) > 1
) dupl ON LOWER(pgroups.name) = dupl.name AND pgroups.month = dupl.month
ORDER BY LOWER(pgroups.name),
pgroups.month,
pgroups.fuzzycount DESC
";
$duplicates = $DB->get_records_sql($sql);

Expand Down
Loading