Browse Source

a 0-card deck error fixed

master
Kostanjevec 4 days ago
parent
commit
a9de33dfb8
  1. 9
      menu.py

9
menu.py

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

Loading…
Cancel
Save