Browse Source

fix player_info crash

Maxim Sokhatsky 11 years ago
parent
commit
b8827b9c2e
4 changed files with 3 additions and 7 deletions
  1. 2 2
      apps/server/src/game.erl
  2. 0 1
      apps/web/src/js_session.erl
  3. 1 1
      apps/web/src/logallow.erl
  4. 0 3
      apps/web/src/okey.erl

+ 2 - 2
apps/server/src/game.erl

@@ -511,8 +511,8 @@ get_player_info(_,User) ->
               lists:concat([Win,"/",Los])}];
               lists:concat([Win,"/",Los])}];
        _ -> [] end end || M <- Okey:modes(), S <- Okey:speeds(), R <- Okey:rounds() ],
        _ -> [] end end || M <- Okey:modes(), S <- Okey:speeds(), R <- Okey:rounds() ],
     Games=lists:flatten(Scoring),
     Games=lists:flatten(Scoring),
-    {ok,Reveals}=kvs:get(reveal_log,User),
-    {ok,Protocol}=kvs:get(protocol_log,User),
+    Reveals  = case kvs:get(reveal_log,User)   of {ok,R} -> R; _ -> #reveal_log{} end,
+    Protocol = case kvs:get(protocol_log,User) of {ok,P} -> P; _ -> #protocol_log{} end,
     #stats_event{
     #stats_event{
         player_id=User,
         player_id=User,
         games=Games,
         games=Games,

+ 0 - 1
apps/web/src/js_session.erl

@@ -11,7 +11,6 @@ init(State,Ctx) -> {ok,State,Ctx}.
 finish(State,Ctx) -> {ok,State,Ctx}.
 finish(State,Ctx) -> {ok,State,Ctx}.
 
 
 generate_cookie(State, Ctx) -> 
 generate_cookie(State, Ctx) -> 
-    wf:info(?MODULE,"Req: ~p",[?REQ]),
     SessionUser = wf:cookie_req(<<"n2o-name">>,?REQ),
     SessionUser = wf:cookie_req(<<"n2o-name">>,?REQ),
     SessionId   = wf:cookie_req(<<"n2o-sid">>, ?REQ),
     SessionId   = wf:cookie_req(<<"n2o-sid">>, ?REQ),
     wf:info(?MODULE,"Session Init n2o-sid: ~p",[SessionId]),
     wf:info(?MODULE,"Session Init n2o-sid: ~p",[SessionId]),

+ 1 - 1
apps/web/src/logallow.erl

@@ -3,7 +3,7 @@
 
 
 log_modules() -> [
 log_modules() -> [
     wf_core,
     wf_core,
-    n2o_bullet,
+%    n2o_bullet,
     game_session,
     game_session,
     n2o_secret,
     n2o_secret,
     js_session,
     js_session,

+ 0 - 3
apps/web/src/okey.erl

@@ -134,9 +134,6 @@ event(join) ->
     GameId = get(okey_game_id),
     GameId = get(okey_game_id),
     wf:wire(protocol:join(wf:to_list(GameId)));
     wf:wire(protocol:join(wf:to_list(GameId)));
 event(take) -> 
 event(take) -> 
-    wf:info(?MODULE,"Req: ~p",[?REQ]),
-    SessionId = wf:cookie_req(<<"n2o-sid">>,?CTX#context.req),
-    wf:info(?MODULE,"Session Internal Init n2o-sid: ~p",[wf:cookies()]),
     GameId = get(okey_game_id),
     GameId = get(okey_game_id),
     wf:wire(protocol:take(wf:to_list(GameId), wf:q(take_src)));
     wf:wire(protocol:take(wf:to_list(GameId), wf:q(take_src)));