finnished first draft of sr_session
parent
4ec65d97a8
commit
404552ab3a
|
@ -64,7 +64,7 @@ def is_due(card_id):
|
|||
return date.today() >= due_date
|
||||
|
||||
|
||||
def list_of_due_cardby_ids(user_id):
|
||||
def list_of_due_card_by_ids(user_id):
|
||||
dbsession = get_session()
|
||||
cards = dbsession.query(Card).filter(Card.owner_id == user_id).all()
|
||||
l = []
|
||||
|
@ -86,8 +86,8 @@ def list_of_new_cards_by_ids(user_id):
|
|||
|
||||
|
||||
def make_deck(user_id, max_new, max_due):
|
||||
due_cards = list_of_due_cardby_ids
|
||||
new_cards = list_of_new_cards_by_ids
|
||||
due_cards = list_of_due_card_by_ids(user_id)
|
||||
new_cards = list_of_new_cards_by_ids(user_id)
|
||||
|
||||
due_deck = []
|
||||
due_deck.append(choices(due_cards, k=max_due))
|
||||
|
@ -130,10 +130,13 @@ def rated_today_by_staus (card_status):
|
|||
|
||||
def get_a_card_by_status(card_status):
|
||||
if card_status == "new":
|
||||
l = lis
|
||||
l = list_of_new_cards_by_ids
|
||||
card_id = choice(list_of_due_card_by_ids)
|
||||
if card_status == "due":
|
||||
l = list_of_due_card_by_ids
|
||||
card_id = choice(list_of_due_card_by_ids)
|
||||
|
||||
return None
|
||||
return card_id
|
||||
|
||||
"""
|
||||
Engine
|
||||
|
@ -187,20 +190,19 @@ def sr_session():
|
|||
if not rate:
|
||||
raise Exception("Need rate info!")
|
||||
|
||||
if rate == "Yes":
|
||||
pass
|
||||
r = Rating(user_id=user_id, card_id=card_id, rating_value=rate, rating_time=date.today())
|
||||
dbsession.add(r)
|
||||
dbsession.commit
|
||||
dbsession.close
|
||||
|
||||
elif rate == "Maybe":
|
||||
pass
|
||||
# Loudamo naslednjo karto v decku
|
||||
|
||||
elif rate == "No":
|
||||
pass
|
||||
|
||||
elif rate == "Delete":
|
||||
#@TODO this should delete the file in some cases.
|
||||
pass
|
||||
#TODO We need this but i don't know it's neccessay to distingush between submit/show
|
||||
show_card = card_id
|
||||
|
||||
# Prikaži obrazec
|
||||
|
||||
# Any more cards?
|
||||
|
||||
#Display from
|
||||
return render_template("deck.html", username=username, card=show_card)
|
||||
|
|
Loading…
Reference in New Issue