@@ -1103,14 +1103,7 @@ async function game(userid: string, pars: { id: string, cbit: string | number, m
11031103 await setSeenTime ( userid , pars . id ) ;
11041104 }
11051105 // hide other player's simultaneous moves
1106- console . log ( `Attempting to get gameinfo for metaGame: "${ game . metaGame } " (game id: ${ pars . id } )` ) ;
1107- const gameInfo = gameinfo . get ( game . metaGame ) ;
1108- if ( gameInfo === undefined ) {
1109- console . error ( `Game metaGame "${ game . metaGame } " not found in gameinfo for game ${ pars . id } ` ) ;
1110- console . error ( `Available games in gameinfo: ${ Array . from ( gameinfo . keys ( ) ) . slice ( 0 , 10 ) . join ( ', ' ) } ...` ) ;
1111- throw new Error ( `Invalid game type: ${ game . metaGame } ` ) ;
1112- }
1113- const flags = gameInfo . flags ;
1106+ const flags = gameinfo . get ( game . metaGame ) . flags ;
11141107 if ( flags !== undefined && flags . includes ( 'simultaneous' ) && game . partialMove !== undefined ) {
11151108 game . partialMove = game . partialMove . split ( ',' ) . map ( ( m : string , i : number ) => ( game . players [ i ] . id === userid ? m : '' ) ) . join ( ',' ) ;
11161109 }
@@ -4391,6 +4384,7 @@ async function submitComment(userid: string, pars: { id: string; players?: {[k:
43914384 } ,
43924385 ExpressionAttributeValues : { ":c" : 1 } ,
43934386 UpdateExpression : "set commented = :c" ,
4387+ ConditionExpression : "attribute_exists(pk) AND attribute_exists(sk)"
43944388 } ) ) ;
43954389 console . log ( `Updated commented flag to 1 for game ${ pars . id } (first interesting comment added)` ) ;
43964390 } catch ( error ) {
@@ -7661,7 +7655,7 @@ async function updateNote(userId: string, pars: {gameId: string; note?: string;}
76617655}
76627656
76637657async function updateCommented ( userId : string , pars : { id : string ; metaGame : string ; cbit : number ; commented : number ; gameEnded ?: number ; } ) {
7664- console . log ( `Updating commented flag for game ${ pars . id } to ${ pars . commented } ` ) ;
7658+ console . log ( `Updating commented flag for game ${ pars . id } to ${ pars . commented } , cbit= ${ pars . cbit } , gameEnded= ${ pars . gameEnded } ` ) ;
76657659 try {
76667660 if ( pars . cbit === 1 && pars . gameEnded !== undefined ) {
76677661 // For completed games, update COMPLETEDGAMES table
0 commit comments