Skip to content

Conversation

@PedroLunet
Copy link
Contributor

@PedroLunet PedroLunet commented Dec 8, 2025

Closes #1754

Description

Updated the TabControllerProvider initialization logic to improve the user experience during evening hours.

Logic Changes:

  • Auto-Advance: If the current time is 21:00 (9 PM) or later, the restaurant menu tab automatically defaults to the next day.
  • Sunday Exception: This logic is disabled on Sundays. On Sunday nights (after 21:00), the tab remains on Sunday (index 6) rather than looping back to Monday, as menus for the upcoming week are typically not yet available.
Simulator Screenshot - iPhone 16e - 2025-12-29 at 21 15 10 simulator_screenshot_5F682ACC-56BE-4840-B166-98B4F50960E8 simulator_screenshot_29C9A92A-D200-49D9-8F38-9C2108E2CF9D simulator_screenshot_971C7864-2E17-4D6C-94F4-535DEB6A6F22

Steps to Replicate

To verify this behavior, you can either modify _getInitialIndex in tab_controller_provider.dart with a hardcoded DateTime or change your emulator/device system time.

Scenarios to test:

  1. Standard Case: Set time to any weekday (e.g., Monday) at 20:00.
    • Expected Result: App opens with Monday selected.
  2. Evening Switch: Set time to any weekday (e.g., Monday) at 21:30.
    • Expected Result: App opens with Tuesday selected.
  3. Sunday Case: Set time to Sunday at 21:30.
    • Expected Result: App opens with Sunday selected (does not jump to Monday).

Review checklist

  • Terms and conditions reflect the changes (N/A)

View Changes

  • Description has screenshots of the UI changes. (N/A - Logic change only)
  • Tested both in light and dark mode. (what is a dark mode)
  • New text is both in portuguese (PT) and english (EN). (No new text added)
  • Works in different text zoom levels.
  • Works in different screen sizes.

Performance

  • No helper functions to return widgets are added. New widgets are created instead.
  • Used ListView.builder for Long Lists.
  • Controllers (TextEditingController, ...) are being disposed of in dispose() method.

@PedroLunet PedroLunet requested a review from a team December 8, 2025 17:03
@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60%. Comparing base (0a63594) to head (a60bb67).
⚠️ Report is 63 commits behind head on develop.

❌ Your project check has failed because the head coverage (60%) is below the target coverage (70%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff           @@
##           develop   #1760   +/-   ##
=======================================
  Coverage       60%     60%           
=======================================
  Files            2       2           
  Lines           81      81           
=======================================
  Hits            48      48           
  Misses          33      33           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements automatic tab advancement in the restaurant menu view for evening hours. After 21:00 (9 PM), the app will display the next day's menu by default, improving user experience by showing more relevant information. A special exception is made for Sunday evenings to avoid showing Monday's menu when the weekly menus aren't yet available.

Key Changes:

  • Extracted initial tab index calculation into a dedicated _getInitialIndex() static method
  • Added logic to advance to the next day's tab when the current time is 21:00 or later
  • Implemented Sunday exception to prevent wrapping from Sunday to Monday

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@pedroafmonteiro pedroafmonteiro left a comment

Choose a reason for hiding this comment

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

looks good to me. thanks!

Copy link
Contributor

@simaopsbarbosa simaopsbarbosa left a comment

Choose a reason for hiding this comment

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

this is working very well, and your logic is solid i think!

when i suggested this feature, i was thinking more about the favorite restaurants module on the home page, which is where i personally check the meals most often. i think it would be nice to see this change there too! maybe with a label saying something like "tomorrow's meals" just to clarify.

what do you think? maybe we can discuss this better with the team in tomorrow's meeting

great work!

@pedroafmonteiro
Copy link
Member

@simaopsbarbosa nice catch! and yes I agree. maybe just a simple message as suggested in the pr that is supposed to clarify the lectures better in the home screen

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Make showing meals for the next day on the night of the day before

4 participants