feat: füge Skripte zur Behebung von SRS-Elementen hinzu, die mit next_due_at gleich oder unmittelbar vor created_at erstellt wurden
All checks were successful
Deploy to production / deploy (push) Successful in 2m11s
All checks were successful
Deploy to production / deploy (push) Successful in 2m11s
This commit is contained in:
23
backend/scripts/fix-srs-queries.sql
Normal file
23
backend/scripts/fix-srs-queries.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- Fix items that were created with next_due_at ~= created_at (within 2 minutes)
|
||||
-- Run this after a backup. Adjust the WHERE clause if you want a different window.
|
||||
|
||||
BEGIN;
|
||||
|
||||
-- Preview rows to be changed
|
||||
SELECT id, item_key, course_id, stage, next_due_at, created_at
|
||||
FROM community.vocab_srs_item
|
||||
WHERE created_at >= now() - interval '3 days'
|
||||
AND abs(EXTRACT(EPOCH FROM (next_due_at - created_at))) < 120
|
||||
ORDER BY created_at ASC
|
||||
LIMIT 200;
|
||||
|
||||
-- Conservative update: set next_due_at to next calendar day at 08:00
|
||||
UPDATE community.vocab_srs_item
|
||||
SET next_due_at = date_trunc('day', created_at + interval '1 day') + interval '8 hours'
|
||||
WHERE created_at >= now() - interval '3 days'
|
||||
AND abs(EXTRACT(EPOCH FROM (next_due_at - created_at))) < 120
|
||||
RETURNING id, item_key, course_id, stage, next_due_at, created_at;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- After running, re-run backend/scripts/diag-srs-stats.js to validate counts.
|
||||
Reference in New Issue
Block a user