Fixed error if user_items was missing query string elements.

This commit is contained in:
neviyn 2015-12-12 00:14:43 +00:00
parent 35ad032d88
commit 1cc615d083

View File

@ -186,13 +186,13 @@ def show_quiz():
@login_required @login_required
def get_items(): def get_items():
level_range = list(range(0, 61)) level_range = list(range(0, 61))
if flask.request.args.get('level_range') is not '': if flask.request.args.get('level_range') and flask.request.args.get('level_range') is not '':
level_range = parse_range(flask.request.args.get('level_range')) level_range = parse_range(flask.request.args.get('level_range'))
item_state = ['burned'] item_state = ['burned']
if flask.request.args.get('item_state') is not '': if flask.request.args.get('item_state') and flask.request.args.get('item_state') is not '':
item_state = flask.request.args.get('item_state').split(',') item_state = flask.request.args.get('item_state').split(',')
item_types = ['radical', 'kanji', 'vocab'] item_types = ['radical', 'kanji', 'vocab']
if flask.request.args.get('item_types') is not '': if flask.request.args.get('item_types') and flask.request.args.get('item_types') is not '':
item_types = flask.request.args.get('item_types').split(',') item_types = flask.request.args.get('item_types').split(',')
return get_items_with_level_restriction(level_range, item_state, item_types) return get_items_with_level_restriction(level_range, item_state, item_types)