a 0-card deck error fixed
parent
c9dacc978e
commit
a9de33dfb8
9
menu.py
9
menu.py
|
@ -1,5 +1,5 @@
|
||||||
from flask import (
|
from flask import (
|
||||||
Blueprint, redirect, render_template, request, session, url_for
|
Blueprint, flash, redirect, render_template, request, session, url_for
|
||||||
)
|
)
|
||||||
|
|
||||||
from config import CONFIG
|
from config import CONFIG
|
||||||
|
@ -48,10 +48,11 @@ def index():
|
||||||
#ustvari novi vnos v Deck
|
#ustvari novi vnos v Deck
|
||||||
user_settings = get_settings(user_id)
|
user_settings = get_settings(user_id)
|
||||||
deck = probabilistic_deck_generator(user_id, int(user_settings['max_new']), int(user_settings['max_due']))
|
deck = probabilistic_deck_generator(user_id, int(user_settings['max_new']), int(user_settings['max_due']))
|
||||||
|
|
||||||
cards_by_id = get_deck(deck)
|
cards_by_id = get_deck(deck)
|
||||||
if cards_by_id == None:
|
if cards_by_id == "":
|
||||||
print("Deck is none")
|
flash("Error: Attempted to make deck with 0 cards. Maybe check settings :)")
|
||||||
return render_template(index())
|
return render_template("menu/menu.html")
|
||||||
else:
|
else:
|
||||||
number_of_cards = len(cards_by_id.split(","))
|
number_of_cards = len(cards_by_id.split(","))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue