Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

fix: remove unapproved sv-SE Gutenberg sentences #656

Merged
merged 1 commit into from
Dec 8, 2022
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

// https://discourse.mozilla.org/t/high-amount-of-low-quality-submissions-in-sentence-collector-makes-reviewing-boring/108368

module.exports = {
up: (queryInterface) => {
return queryInterface.sequelize.query(`
WITH IDsToDelete AS (SELECT
Sentences.id
FROM Sentences
LEFT JOIN Votes ON (Votes.sentenceId=Sentences.id)
WHERE
Sentences.localeId = "sv-SE" AND
Sentences.source = "Project Gutenberg, with slight tweaks by me."
GROUP BY Sentences.id
HAVING
COUNT(Votes.approval) < 2 OR
COUNT(Votes.approval) = 2 AND SUM(Votes.approval) = 1
)
DELETE FROM Sentences WHERE id IN (SELECT id FROM IDsToDelete);
`);
},
down: () => Promise.resolve(),
};