(bug) player now also advances game, but can double discard

This commit is contained in:
Tao Tien 2026-02-24 19:36:39 -08:00
parent e8dd782f59
commit 5ebf3f6c05
4 changed files with 12 additions and 6 deletions

View file

@ -19,9 +19,9 @@ pub fn advance_game(ctx: &ReducerContext, mut game_timer: GameTimer) -> Result<(
// checks every second (or more? when users make moves) on whether to advance the game's various states
// TODO this, or allow player/debug to call this?
if !ctx.sender_auth().is_internal() {
return Err("This reducer can only be called by the scheduler".to_string());
}
// if !ctx.sender_auth().is_internal() {
// return Err("This reducer can only be called by the scheduler".to_string());
// }
if let Some(mut lobby) = ctx.db.lobby().id().find(game_timer.lobby_id) {
trace!("running schedule for lobby {}", lobby.id);

View file

@ -108,7 +108,7 @@ pub struct Bot {
pub working_tile: Option<DbTile>,
}
#[table(name = game_timer, scheduled(advance_game))]
#[table(name = game_timer, scheduled(advance_game), public)]
pub struct GameTimer {
#[primary_key]
#[auto_inc]