when adding cards, use rand(1, maxfid)

this means that content added earlier has a higher chance of appearing, but it
makes it consistent with sortCards(), and the user can sort manually if need
be
This commit is contained in:
Damien Elmes 2011-04-21 10:59:32 +09:00
parent c4c1cdeb6b
commit 431fd2585e

View file

@ -233,7 +233,7 @@ qconf=?, conf=?, data=?""",
fact.flush() fact.flush()
# randomize? # randomize?
if self.randomNew(): if self.randomNew():
due = random.randrange(1, 1000000) due = random.randrange(1, fact.id)
else: else:
due = fact.id due = fact.id
# add cards # add cards
@ -289,7 +289,7 @@ select id from facts where id not in (select distinct fid from cards)""")
# if this fact has existing new cards, use their due time # if this fact has existing new cards, use their due time
due = self.db.scalar( due = self.db.scalar(
"select due from cards where fid = ? and queue = 0", fact.id) "select due from cards where fid = ? and queue = 0", fact.id)
due = due or random.randrange(1, 1000000) due = due or random.randrange(1, self.conf['nextFid'])
else: else:
due = fact.id due = fact.id
for template in self.findTemplates(fact, checkActive=False): for template in self.findTemplates(fact, checkActive=False):