ソースを参照

Bug in key '1' in dict alert

Foppe Hemminga 6 年 前
コミット
0a83b8b038
2 ファイル変更2 行追加1 行削除
  1. 1 0
      main.py
  2. 1 1
      model.py

+ 1 - 0
main.py

@@ -88,6 +88,7 @@ if __name__ == '__main__':
                 # We just sent an alert
                 temp_status_json['alert'][str(minutes_to_go)] = True
                 temp_status_json_to_write = json.dumps(temp_status_json, indent=2)
+                pprint(temp_status_json_to_write)
                 write_file = open(f'status-{player_id}.json', 'w')
                 write_file.write(temp_status_json_to_write)
                 write_file.close()

+ 1 - 1
model.py

@@ -47,7 +47,7 @@ def _get_status(this_id):
     # pprint(this_status)
     status_return = None
     if 'alert' not in this_status:
-        this_status['alert'] = {'15': False, '10': False, '5': False, '0': False}
+        this_status['alert'] = {'15': False, '10': False, '5': False, '1': False}
     if this_status:
         status_return = this_status['status'], this_status['name'], this_status['timestamp'], this_status['alert']
     return status_return