Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Minor Laundry Bug #329

Merged
merged 18 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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)

Check warning on line 54 in backend/laundry/views.py

View check run for this annotation

Codecov / codecov/patch

backend/laundry/views.py#L54

Added line #L54 was not covered by tests

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

Expand Down
Loading