Created
April 9, 2012 14:55
-
-
Save knewter/2344034 to your computer and use it in GitHub Desktop.
incorrect first effort at SRS algorithm (this one just gets cards that haven't been answered longest first)
This file contains hidden or 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
#I'm implementing a flashcard learning system. I have cards and answers. I want a SQL query that will return the card that has been answered longest ago (so if you've not answered a card in a long time, you should be more likely to see it) | |
SELECT DISTINCT "cards".id FROM "cards" LEFT OUTER JOIN "answers" ON "answers"."card_id" = "cards"."id" LEFT OUTER JOIN "decks" ON "decks"."id" = "cards"."deck_id" WHERE (deck_id = 1) ORDER BY answers.created_at ASC LIMIT 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment