This repository has been archived by the owner on May 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove unapproved sv-SE Gutenberg sentences (#656)
- Loading branch information
1 parent
d71c19e
commit 06de170
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
server/migrations/20221208220000-remove-not-yet-approved-sv-sentences-gutenberg.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
}; |