diff --git a/app/main/routes.py b/app/main/routes.py index bed26ce..144a3c0 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -135,7 +135,7 @@ def catch_bunny(game_name): flash('Only hunters can catch bunnies!') abort(403) if not game.is_active(): - flash("Its not possible to catch a bunny before or after a game, or if the game is not in 'started' mode.") + flash("Its not possible to catch a bunny before or after a game, or if the game is not in 'active' mode.") return redirect(url_for('main.game_dashboard', game_name=game.name)) game_bunnies = game.bunnies() @@ -331,7 +331,7 @@ def objective(objective_hash): objective = Objective.query.filter_by(hash=objective_hash).first_or_404() if current_user.role_in_game(objective.game) == Role.bunny: if not objective.game.is_active(): - flash("Its not find an objective before or after a game, or if the game is not in 'started' mode.") + flash("Its not find an objective before or after a game, or if the game is not in 'active' mode.") return redirect(url_for('main.game_dashboard', game_name=objective.game.name)) player = current_user.player_in(objective.game) if not objective in player.found_objectives: diff --git a/app/models/game.py b/app/models/game.py index ed433d2..b7cd1d7 100644 --- a/app/models/game.py +++ b/app/models/game.py @@ -72,4 +72,4 @@ class Game(db.Model): now = datetime.utcnow() return now > (self.start_time or datetime.min) and \ now < (self.end_time or datetime.max) and \ - self.state == GameState.started \ No newline at end of file + self.state == GameState.active \ No newline at end of file diff --git a/app/models/game_state.py b/app/models/game_state.py index 7c50865..49fc767 100644 --- a/app/models/game_state.py +++ b/app/models/game_state.py @@ -3,7 +3,7 @@ from enum import Enum class GameState(Enum): initiated = 1 published = 2 - started = 3 + active = 3 interrupted = 4 finished = 5 \ No newline at end of file diff --git a/database_dump.txt b/database_dump.txt index b93c76e..ffe3c9b 100644 --- a/database_dump.txt +++ b/database_dump.txt @@ -12,7 +12,7 @@ CREATE TABLE game ( start_time DATETIME, end_time DATETIME, PRIMARY KEY (id), - CONSTRAINT gamestate CHECK (state IN ('initiated', 'published', 'started', 'interrupted', 'finished')) + CONSTRAINT gamestate CHECK (state IN ('initiated', 'published', 'active', 'interrupted', 'finished')) ); INSERT INTO game VALUES(1,'Marijns Game','initiated','2020-07-09 12:56:00.000000',NULL); INSERT INTO game VALUES(2,'Spelletje','initiated',NULL,NULL); diff --git a/documentation/gamestate.txt b/documentation/gamestate.txt index 906518a..e02f54e 100644 --- a/documentation/gamestate.txt +++ b/documentation/gamestate.txt @@ -3,6 +3,6 @@ Gamestate This is an attribute of the Game class. It will be implemented as an enum containing the following values: initiated = 1 published = 2 -started = 3 +active = 3 interrupted = 4 finished = 5 diff --git a/migrations/versions/d87b14d6a90c_add_pcp_review.py b/migrations/versions/d87b14d6a90c_add_pcp_review.py index 772e9a6..be5ed93 100644 --- a/migrations/versions/d87b14d6a90c_add_pcp_review.py +++ b/migrations/versions/d87b14d6a90c_add_pcp_review.py @@ -21,7 +21,7 @@ def upgrade(): op.create_table('game', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=64), nullable=False), - sa.Column('state', sa.Enum('initiated', 'published', 'started', 'interrupted', 'finished', name='gamestate'), server_default='initiated', nullable=False), + sa.Column('state', sa.Enum('initiated', 'published', 'active', 'interrupted', 'finished', name='gamestate'), server_default='initiated', nullable=False), sa.Column('start_time', sa.DateTime(), nullable=True), sa.Column('end_time', sa.DateTime(), nullable=True), sa.PrimaryKeyConstraint('id')