move to SRS Algo
This commit is contained in:
parent
e992a38235
commit
377cfdfa97
|
|
@ -33,7 +33,12 @@ def init_db():
|
|||
x1 REAL,
|
||||
x2 REAL,
|
||||
y1 REAL,
|
||||
y2 REAL
|
||||
y2 REAL,
|
||||
due INTEGER DEFAULT (CAST((julianday('now') - julianday('1970-01-01')) AS INTEGER)),
|
||||
ivl REAL DEFAULT 0.0,
|
||||
factor REAL DEFAULT 2.5,
|
||||
reps INTEGER DEFAULT 0,
|
||||
lapses INTEGER DEFAULT 0
|
||||
)
|
||||
''')
|
||||
conn.commit()
|
||||
|
|
@ -172,10 +177,16 @@ def get_decks():
|
|||
'name': entry['bildname'],
|
||||
'id': entry['bildid'],
|
||||
'iconindex': entry['iconindex'],
|
||||
'boxid':entry['id'],
|
||||
'x1': entry['x1'],
|
||||
'x2': entry['x2'],
|
||||
'y1': entry['y1'],
|
||||
'y2': entry['y2']
|
||||
'y2': entry['y2'],
|
||||
'due': entry['due'],
|
||||
'ivl': entry['ivl'],
|
||||
'factor': entry['factor'],
|
||||
'reps': entry['reps'],
|
||||
'lapses': entry['lapses'],
|
||||
}
|
||||
decks[deckname]['images'].append(image)
|
||||
|
||||
|
|
@ -423,6 +434,26 @@ def move_image(bildid):
|
|||
if conn:
|
||||
conn.close()
|
||||
|
||||
@deck_bp.route('/api/decks/boxes/<int:box_id>', methods=['PUT'])
|
||||
def update_box(box_id):
|
||||
data = request.get_json()
|
||||
due = data.get('due', 0)
|
||||
ivl = data.get('ivl', 0.0)
|
||||
factor = data.get('factor', 2.5)
|
||||
reps = data.get('reps', 0)
|
||||
lapses = data.get('lapses', 0)
|
||||
|
||||
conn = get_db_connection()
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("""
|
||||
UPDATE Deck
|
||||
SET due = ?, ivl = ?, factor = ?, reps = ?, lapses = ?
|
||||
WHERE id = ?
|
||||
""", (due, ivl, factor, reps, lapses, box_id))
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
return jsonify({'status': 'success'}), 200
|
||||
# Sicherstellen, dass die Datenbank existiert
|
||||
if not os.path.exists(DATABASE):
|
||||
init_db()
|
||||
|
|
|
|||
Loading…
Reference in New Issue