popravljen deck bug zares?

master
janko 2023-02-05 20:43:20 +01:00
parent 09d9da152e
commit 0dc571eb56
1 changed files with 6 additions and 6 deletions

View File

@ -106,7 +106,7 @@ def list_of_new_cards_by_ids(user_id):
dbsession.close() dbsession.close()
return l return l
def rated_today_by_staus (card_status, user_id): def rated_today_by_staus (card_status, user_id):
""" """
Returns number of cards rated today by user by status (new or due) Returns number of cards rated today by user by status (new or due)
@ -121,7 +121,7 @@ def rated_today_by_staus (card_status, user_id):
n = 0 n = 0
d = 0 d = 0
for rating in ratings_today: for rating in ratings_today:
count_all_rates_of_card = dbsession.query(Card).filter(Card.id == rating.card_id).count() count_all_rates_of_card = dbsession.query(Rating).filter(rating.card_id == Rating.card_id).count()
print("count_all_rates_of_card: ", count_all_rates_of_card) print("count_all_rates_of_card: ", count_all_rates_of_card)
if count_all_rates_of_card == 1: if count_all_rates_of_card == 1:
@ -254,17 +254,17 @@ def sr_session():
#max can be more than all scheduled, min decides which is the limt. #max can be more than all scheduled, min decides which is the limt.
if remaining_new_today > 0: if remaining_new_today > 0:
print("gettin new") ##TODO problem je, ker na produkciji zgleda kot da jemlje skoz new, čeprav bi moral due print("gettin new") ##TODO problem je, ker na produkciji zgleda kot da jemlje skoz new, čeprav bi moral due
new_card_id=get_a_card_by_status(user_id, "new") next_card_id=get_a_card_by_status(user_id, "new")
elif remaining_due_today > 0: elif remaining_due_today > 0:
print("getting due") print("getting due")
new_card_id=get_a_card_by_status(user_id, "due") next_card_id=get_a_card_by_status(user_id, "due")
else: else:
dbsession.close() dbsession.close()
flash("no more cards today") flash("no more cards today")
return redirect("/menu") return redirect("/menu")
show_card = dbsession.query(Card).get(new_card_id) show_card = dbsession.query(Card).get(next_card_id)
interval = get_interval(new_card_id) interval = get_interval(next_card_id)
#these factors should be better packaged #these factors should be better packaged
return render_template("deck.html", username=username, card=show_card, maybe_in=round(interval*maybe_factor), no_in=round(no_factor*interval)) return render_template("deck.html", username=username, card=show_card, maybe_in=round(interval*maybe_factor), no_in=round(no_factor*interval))