|
@@ -7,7 +7,7 @@ from pydantic import conint, constr
|
|
|
from sqlalchemy.orm import Session
|
|
|
|
|
|
from .. import scoring
|
|
|
-from ..schemas import GameConfig, Guess, ScoreMethodEnum
|
|
|
+from ..schemas import GameConfig, GameModeEnum, Guess, ScoreMethodEnum
|
|
|
from ..db import get_db, queries, models
|
|
|
from ..point_gen import points, ExhaustedSourceError, reverse_geocode
|
|
|
|
|
@@ -167,6 +167,9 @@ async def submit_guess(round_number: conint(gt=0),
|
|
|
|
|
|
if game.round_point_cap is not None:
|
|
|
score = min(score, max(0, game.round_point_cap - sum(g.round_score for p in game.players for g in p.guesses if g.round_number == round_number)))
|
|
|
+ if game.game_mode == GameModeEnum.gun_game and round_number == game.rounds and queries.get_first_submitter(db, game.game_id, round_number) is None:
|
|
|
+ # first to submit in the last round of gun game gets 10k bonus points to ensure they are the winner of the whole game
|
|
|
+ score += 10_000
|
|
|
added = queries.add_guess(db, guess, player, country_code, round_number, score)
|
|
|
if not added:
|
|
|
raise HTTPException(status_code=409, detail="Already submitted guess for this round")
|