Skip to content

Commit

Permalink
Merge pull request #5954 from jwarwick/zombie
Browse files Browse the repository at this point in the history
Decapitate zombie games
  • Loading branch information
jwarwick authored Jun 10, 2021
2 parents 3bb4a4d + 8555fc2 commit 1b7a900
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/clj/web/stats.clj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
(defn build-stats-kw
"Take a stats prefix and add a side to it"
[prefix side]
(keyword (apply str prefix (lower-case side))))
(keyword (apply str prefix (lower-case (or side "Corp")))))

(defn inc-deck-stats
"Update deck stats for a given counter"
Expand Down Expand Up @@ -112,9 +112,13 @@
(let [start-players (get-in @all-games [gameid :original-players])
end-players (get-in @all-games [gameid :ending-players])]
(doseq [p start-players]
(inc-game-stats db (get-in p [:user :_id]) (game-record-start p)))
(if (:side p)
(inc-game-stats db (get-in p [:user :_id]) (game-record-start p))
(println "NULL start player side in stats for gameid" gameid)))
(doseq [p end-players]
(inc-game-stats db (get-in p [:user :_id]) (game-record-end all-games gameid p)))))
(if (:side p)
(inc-game-stats db (get-in p [:user :_id]) (game-record-end all-games gameid p))
(println "NULL end player side in stats for gameid" gameid)))))

(defn push-stats-update
"Gather updated deck and user stats and send via web socket to clients"
Expand Down

0 comments on commit 1b7a900

Please sign in to comment.