Permalink
Browse files

Updates for correctly handling failed scenario log results

  • Loading branch information...
1 parent e187da1 commit a56815408663f1b445095c9020f1c997ff217437 @porksmash committed Jul 14, 2016
Showing with 6 additions and 1 deletion.
  1. +6 −1 com2us_parser.py
View
@@ -402,7 +402,7 @@ def parse_battle_result(battle_result):
# Rewards
if battle_result['reward']:
- log_entry.mana = battle_result['reward'].get('mana')
+ log_entry.mana = battle_result['reward'].get('mana', 0)
log_entry.energy = battle_result['reward'].get('energy', 0)
log_entry.crystal = battle_result['reward'].get('crystal', 0)
@@ -498,5 +498,10 @@ def parse_battle_result(battle_result):
drop_mon.level = 1
drop_mon.save()
log_entry.drop_monster = drop_mon
+ else:
+ # Failed runs with 0 enemy kills have no reward crate
+ log_entry.mana = 0
+ log_entry.energy = 0
+ log_entry.crystal = 0
log_entry.save()

0 comments on commit a568154

Please sign in to comment.