Skip to content

Adding StatusFragment to indicate if the item can stay in the pantry

Tyler Sizse requested to merge issue_227_traffic_light_fragment into main

License and Copyright Notice

By submitting this issue or commenting on this issue, or contributing any content to this issue, you certify under the Developer Certificate of Origin that the content you post may be licensed under GPLv3 (for code) or CC-BY-SA 4.0 International (for non-code content).

Branch Name

issue_227_traffic_light_fragment

Related Issues

Dependencies

NOTE: I'm leaving these dependencies listed here, but am removing the requirement of them needing to be merged first. This merge request should be ok to be merge without the need of merging these dependencies.

Description

This merge request will add a new fragment/UI that appears after SelectPrintedExpirationDateFragment that will display the items shelf life status using "traffic light" colors.

  • #BBBBBB Gray means the shelf life is unknown. (Either shelfLife = null or shelfLife.getMetric() = null)
  • #EE0000 Red means the item is no longer good and should be discarded.
  • #EEEE00 Yellow means the item is within 30 days of expiration.
  • #00EE00 Green means the item is good for 30 days or more.

This fragment will have a "More Info" button that goes to MoreInfoFragment (currently named DisplayTrueExpirationFragment). This fragment will also allow the user to return to SelectPrintedExpirationDateFragment if they have another of the same item with a different expiration date.

Steps to Test

  1. Go to the 'Check Expiration Date' feature within the app.
  2. Scan or enter a barcode.
  3. Fill in the required information if in SelectItemFragment, or press confirm if in ConfirmItemFragment.
  4. Press 'Accept'
  5. Select a random date.
  6. Press 'Accept'
    • You should now see the new StatusFragment
    • Make sure it is displaying the correct data.
    • Repeat all the previous steps with different items and dates.
  7. Press the "More Info" button.
    • Make sure info was passed correctly to MoreInfoFragment
  8. Press the back button.
  9. Press the back button.
    • You should now be taken back to SelectPrintedExpirationDateFragment.

Make sure you are able to enter another printed expiration date for.

Relevant Screenshots

Screenshot_1627170129 Screenshot_1627169274 Screenshot_1627169311 Screenshot_1627169331 Screenshot_1627169057

Relevant Logs

N/A

Developer Notes

  • Added new StatusFragment
  • Updated nav graphs for new fragment
  • Added 5 different possible statuses
    • #BBBBBB Unknown
    • #EE0000 Red - Discard
    • #EEEE00 Yellow - Warning
    • #00EE00 Green - Safe
    • #00EE00 Green Infinity - Safe and Indefinite
  • Added listener for back button
  • Added expiration date calculation according to the new issue #228 (closed)
    • Note this does not completely fix the issue.
  • Update welcome message in StartFragment.
  • Merged recent changes from !228 (merged) into this branch.
  • Used max directly when calculating the expiration date until we get a more solid answer about issue #228 (closed).
  • Renamed DisplayTrueExpirationFragment to MoreInfoFragment so the name better reflects what the fragment is used for.

LABELS

NEST component:check-expiration-date type::feature status::doing

Edited by Tyler Sizse

Merge request reports