mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00

- rename to revlog - change the pk to time, as we want an index on time, and the old multi-column index was expensive and not useful - remove yes/no count; they can be inferred from the ease - remove lastFactor, as it's in the previous entry - remove delay, it can be inferred from last entry - remove 'next' from nextInterval and nextFactor - rename 'thinkingTime' to 'userTime' - rename reps to rep - migrate old data to new table, and fix some problems in the process: ease0 -> ease1, and limit thinking time to 60 seconds as it should have been previously
32 lines
1.3 KiB
Python
32 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Copyright: Damien Elmes <anki@ichi2.net>
|
|
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
|
|
|
import time
|
|
from anki.db import *
|
|
|
|
# Flags: 0=standard review, 1=reschedule due to cram, drill, etc
|
|
# Rep: Repetition number. The same number may appear twice if a card has been
|
|
# manually rescheduled or answered on multiple sites before a sync.
|
|
|
|
revlogTable = Table(
|
|
'revlog', metadata,
|
|
Column('time', Float, nullable=False, primary_key=True, default=time.time),
|
|
Column('cardId', Integer, nullable=False),
|
|
Column('ease', Integer, nullable=False),
|
|
Column('rep', Integer, nullable=False),
|
|
Column('lastInterval', Float, nullable=False),
|
|
Column('interval', Float, nullable=False),
|
|
Column('factor', Float, nullable=False),
|
|
Column('userTime', Float, nullable=False),
|
|
Column('flags', Integer, nullable=False, default=0))
|
|
|
|
def logReview(db, card, ease, flags=0):
|
|
db.statement("""
|
|
insert into revlog values (
|
|
:created, :cardId, :ease, :rep, :lastInterval, :interval, :factor,
|
|
:userTime, :flags)""",
|
|
created=time.time(), cardId=card.id, ease=ease, rep=card.reps,
|
|
lastInterval=card.lastInterval, interval=card.interval,
|
|
factor=card.factor, userTime=card.thinkingTime(),
|
|
flags=flags)
|