Selaa lähdekoodia

Add _debug to supress confusing debug message

Foppe Hemminga 6 vuotta sitten
vanhempi
commit
63ae8df723
2 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. 1 1
      main.py
  2. 2 2
      model.py

+ 1 - 1
main.py

@@ -27,7 +27,7 @@ if __name__ == '__main__':
 
         timestamp_when_okay = int(status['timestamp'])
         if status['integer'] == 0:
-            seconds_in_hosp = model.extract_hospital_time(status['text'])
+            seconds_in_hosp = model.extract_hospital_time(status['text'], _debug=True)
             timestamp_when_okay += seconds_in_hosp
         if old_status != status['integer']:
             calculate_next_opportunity = True

+ 2 - 2
model.py

@@ -105,7 +105,7 @@ def get_json_file(this_player_id):
     return _read_json_file(this_player_id)
 
 
-def extract_hospital_time(this_message_text):
+def extract_hospital_time(this_message_text, _debug=False):
     regex = re.compile(r'( (?P<hours>\d+) hrs)?( (?P<minutes>\d+) mins)?( (?P<seconds>\d+) secs)? ')
     hours = 0
     minutes = 0
@@ -142,7 +142,7 @@ def calculate_time_to_next_attack(this_player_id):
     starting_time = int(this_status_json['timestamp'])
     if this_status_integer == 0:
         status_text = this_status_json['text']
-        seconds_till_level_iv += extract_hospital_time(status_text)
+        seconds_till_level_iv += extract_hospital_time(status_text, _debug=False)
     if this_status_integer <= 1:
         seconds_till_level_iv += 30 * 60
     if this_status_integer <= 2: