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

feat: new restaurants api #1393

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from

Conversation

HenriqueSFernandes
Copy link
Contributor

@HenriqueSFernandes HenriqueSFernandes commented Nov 18, 2024

WIP implementation of the new restaurants API.
It includes changes that will be undone before the merge, such as changing the provider to always fetch from the remote and debug print messages.
Currently, the meals page includes every establishment from SASUP, but it uses the menu from the old Excel file.

Closes #1360

Review checklist

  • Terms and conditions reflect the current change
  • Contains enough appropriate tests
  • If aimed at production, writes a new summary in whatsnew/whatsnew-pt-PT
  • Properly adds an entry in changelog.md with the change
  • If PR includes UI updates/additions, its description has screenshots
  • Behavior is as expected
  • Clean, well-structured code

@HenriqueSFernandes HenriqueSFernandes linked an issue Nov 18, 2024 that may be closed by this pull request
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 4.34783% with 88 lines in your changes missing coverage. Please review.

Project coverage is 12%. Comparing base (1002364) to head (af50845).
Report is 3 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff           @@
##           develop   #1393   +/-   ##
=======================================
+ Coverage       12%     12%   +1%     
=======================================
  Files          264     264           
  Lines         7245    7270   +25     
=======================================
+ Hits           803     807    +4     
- Misses        6442    6463   +21     

@HenriqueSFernandes
Copy link
Contributor Author

HenriqueSFernandes commented Nov 18, 2024

It seems to be working with the meals hardcoded (using week 40), but there is a problem with saving the meals in the local storage. From what I can see, that problem already existed before.

When calling db.saveIfPersistentSession(restaurants):

image

@HenriqueSFernandes HenriqueSFernandes changed the title Feat/new restaurants api feat: new restaurants api Nov 19, 2024
@HenriqueSFernandes
Copy link
Contributor Author

The new menu's API has been implemented.

Due to the current front-end implementation restrictions, the old Restaurant model was used, but the new UI will use the more complete Establishment model by @thePeras.

The loadFromStorage function in the restaurant_provider was changed so as not to cause a crash. The commented code should be reimplemented after issue #1370 is fixed.

Special thanks to @AugustoVSoares for the collaboration on this implementation.

@HenriqueSFernandes HenriqueSFernandes marked this pull request as ready for review December 1, 2024 22:41
@HenriqueSFernandes
Copy link
Contributor Author

The distinction between lunch and dinner is hard coded, so it always displays "Almoço / Jantar" regardless of the app's language setting.
I propose discussing in the next meeting whether this should be addressed now or postponed until the new UI is implemented. Personally, I suggest waiting for the new UI, as the fix would not be necessary.

@HenriqueSFernandes HenriqueSFernandes requested a review from a team December 1, 2024 22:52
@HenriqueSFernandes
Copy link
Contributor Author

As discussed in today's meeting, I added the English names for the meals

Feel free to suggest more changes.

Copy link
Member

@thePeras thePeras left a comment

Choose a reason for hiding this comment

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

Incredibly work!! It's so nice to see this finally in UNI.

After this detail, it's ready to 🛫

@@ -46,6 +46,7 @@ class RestaurantDatabase extends AppDatabase<List<Restaurant>> {
return Restaurant(
restaurantId,
map['name'] as String,
map['period'] as String,
Copy link
Member

Choose a reason for hiding this comment

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

Because you modify the database table, increase its version. Since it's stills in v1, you need to create migration code. Look at #1380

@thePeras thePeras requested a review from a team December 9, 2024 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove fetch sheet code and implement new menu's api
2 participants