Skip to content

Commit

Permalink
[Fix] Minor Laundry Bug (#329)
Browse files Browse the repository at this point in the history
* Laundry rewrite for new Penn API sans tests

* Make PR changes

* Rewrite laundry mocks

* Laundry testing

* Comment out tests - approved by team lead

* Lint

* Testing + new migrations

* Reflect model change to penndata

* Make changes

* Squash migrations

* Lint

* Fix Laundry Time Bug

* Pipfile

* Fix for IOS
  • Loading branch information
dr-Jess authored Nov 22, 2024
1 parent b0105a1 commit 04cedd5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 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
2 changes: 1 addition & 1 deletion backend/laundry/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get(self, request, room_ids):
room_data = room_status(get_object_or_404(LaundryRoom, room_id=room_id))
room_data["id"] = room_id
room_data["usage_data"] = HallUsage.compute_usage(room_id)
output["rooms"].append(room_id)
output["rooms"].append(room_data)

record_analytics(Metric.LAUNDRY_VIEWED, request.user.username)

Expand Down

0 comments on commit 04cedd5

Please sign in to comment.