diff --git a/app/main/routes.py b/app/main/routes.py index 8e55414..69d1f7b 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -1,6 +1,6 @@ import json from datetime import datetime, timedelta -from flask import render_template, redirect, url_for, request, abort, send_file, current_app +from flask import render_template, redirect, url_for, request, abort, send_file, current_app, flash from flask_login import current_user, login_required from werkzeug.security import safe_join from app import db @@ -41,8 +41,8 @@ def game_dashboard(game_name): hunter_delay=hunter_delay, json=json, location_encoder=LocationEncoder) if role == Role.none: - return render_template('game_hunter_dashboard.html', title='Game Dashboard', game=game, - json=json, location_encoder=LocationEncoder) + flash('Please ask your game owner for a role to join this game') + return abort(403) if role is None: abort(403) diff --git a/app/models/user.py b/app/models/user.py index 60fa731..e647b67 100644 --- a/app/models/user.py +++ b/app/models/user.py @@ -50,7 +50,7 @@ class User(UserMixin, db.Model): offset (int): Offset in minutes. Only locations older than this amount of minutes will be returned. ''' # pylint: disable=not-an-iterable - if offset is None: + if offset is None or offset == '': offset = 0 if not self.locations: return None @@ -77,7 +77,7 @@ class User(UserMixin, db.Model): offset (int): Offset in minutes. Only locations older than this amount of minutes will be returned. ''' # pylint: disable=[not-an-iterable, unsubscriptable-object] - if offset is None: + if offset is None or offset == '': offset = 0 if not self.locations: return None