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] Laundry Rewrite to Account For New SpeedQueen API #308

Merged
merged 13 commits into from
Nov 17, 2024

Conversation

dr-Jess
Copy link
Contributor

@dr-Jess dr-Jess commented Sep 29, 2024

Rewrite laundry to handle Penn's new SpeedQueen API, without changing anything that would affect the frontend. Future plans are to hard rewrite (new API has more data, such as whether a machine door is open/could be used to tell when laundry hasn't been taken out!!!), but this is a quick fix.

Some notes on the new API:
Statuses are entirely reworked, but I've left the possible options as the old ones and lined them up best I can as to not break the frontend.
Additionally, the API is now actually relational!! with locations and rooms instead of a page to be scraped. This means we'll have to properly track both locations and the rooms in them now, modifying our requests to match this pattern.

@dr-Jess
Copy link
Contributor Author

dr-Jess commented Sep 29, 2024

Currently fails all tests because tests are written on a mock of the old API, will have to rewrite (or maybe we just test it live?) >:)

@dr-Jess dr-Jess requested review from tuneerroy and vcai122 and removed request for tuneerroy September 29, 2024 08:36
Copy link
Contributor

@tuneerroy tuneerroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just did a brief glance, dk about logic

backend/laundry/api_wrapper.py Outdated Show resolved Hide resolved
backend/laundry/api_wrapper.py Outdated Show resolved Hide resolved
backend/laundry/management/commands/load_laundry_rooms.py Outdated Show resolved Hide resolved
@tuneerroy
Copy link
Contributor

Currently fails all tests because tests are written on a mock of the old API, will have to rewrite (or maybe we just test it live?) >:)

sorry kiddo, gotta write the tests before we deploy :)

@vcai122
Copy link
Contributor

vcai122 commented Sep 29, 2024

Currently fails all tests because tests are written on a mock of the old API, will have to rewrite (or maybe we just test it live?) >:)

Have you tested this manually?

I think it wouldn't be too much of a lift to mock the new one? It should be just in a couple places right?

Copy link
Contributor

@vcai122 vcai122 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HE DID IT!!!!!!! 6 shots

left most of my questions throughout

couple notes for READABILITY

  • indexes are EVIL
  • compute stuff seperately if it makes it more clear (don't jam everything in the same for loop this is not a leetcode problem, but also you shouldn't be solving ur leetcode problems that way anyway)
  • similar to above don't feel the need to be ultra efficient by only doing 1 for loop. Readability is number 1 concern

Copy link

codecov bot commented Nov 17, 2024

Codecov Report

Attention: Patch coverage is 78.26087% with 20 lines in your changes missing coverage. Please review.

Project coverage is 89.60%. Comparing base (d1044c2) to head (c5ad053).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
backend/laundry/api_wrapper.py 69.44% 11 Missing ⚠️
...aundry/management/commands/update_laundry_rooms.py 75.00% 6 Missing ⚠️
backend/laundry/views.py 84.21% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #308      +/-   ##
==========================================
- Coverage   90.23%   89.60%   -0.64%     
==========================================
  Files          66       67       +1     
  Lines        2684     2704      +20     
==========================================
+ Hits         2422     2423       +1     
- Misses        262      281      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dr-Jess
Copy link
Contributor Author

dr-Jess commented Nov 17, 2024

Made significant changes + testing; before merging please don't allow me to forget to squash migrations. How many shots?

Copy link
Contributor

@tuneerroy tuneerroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work :)

backend/laundry/api_wrapper.py Outdated Show resolved Hide resolved
backend/laundry/api_wrapper.py Outdated Show resolved Hide resolved
backend/laundry/serializers.py Show resolved Hide resolved
backend/penndata/views.py Outdated Show resolved Hide resolved
@dr-Jess dr-Jess requested a review from tuneerroy November 17, 2024 17:56
@dr-Jess dr-Jess marked this pull request as ready for review November 17, 2024 18:24
Copy link
Contributor

@vcai122 vcai122 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
i think?

Copy link
Contributor

@tuneerroy tuneerroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dr-Jess dr-Jess merged commit b806dc7 into master Nov 17, 2024
7 of 9 checks passed
@dr-Jess dr-Jess deleted the fix/laundry-api-rewrite branch November 17, 2024 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants