Skip to content

Commit

Permalink
Fix Laundry Time Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-Jess committed Nov 17, 2024
1 parent c5ad053 commit b02da6c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions backend/laundry/api_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def update_machine_object(machine, machine_type_data):
time_remaining = machine["currentStatus"]["remainingSeconds"]
machine_type_data["running"] += 1
try:
machine_type_data["time_remaining"].append(int(time_remaining))
machine_type_data["time_remaining"].append(int(time_remaining) // 60)
except ValueError:
pass
elif status in ["AVAILABLE", "COMPLETE"]:
Expand Down Expand Up @@ -81,7 +81,11 @@ def parse_a_room(room_request_link):
"id": machine["id"],
"type": "washer" if machine["isWasher"] else "dryer",
"status": machine["currentStatus"]["statusId"],
"time_remaining": machine["currentStatus"]["remainingSeconds"],
"time_remaining": (
int(machine["currentStatus"]["remainingSeconds"]) // 60
if machine["currentStatus"]["statusId"] == "IN_USE"
else 0
),
}
for machine in request_json
if machine["isWasher"] or machine["isDryer"]
Expand Down

0 comments on commit b02da6c

Please sign in to comment.