Skip to content

Fixing issue with prior year missing in SelectPrintedExpirationDateFragment

Tyler Sizse requested to merge issue_224_prior_years_missing into master

BRANCH NAME

issue_224_prior_years_missing

RELATED ISSUES

Closes #224 (closed);

DEPENDANTS

!223 (merged)

DESCRIPTION

Fixing issue with prior years missing in SelectPrintedExirationDateFragment when selecting a year.

This merge request also includes some enhancements for SelectPrintedExpirationDateFragment:

  • General layout and code clean-up/organization
  • Dedicated "UPC" label
  • Converted PopupMenus to NumberPickers

SELECTABLE YEAR RANGE REASONING

I ran the following query on the Nest.db database using the printLongestShelfLife() method below to get the maximum shelf-life that exists:

SELECT min, MAX(max), metric FROM view_shelf_lives_and_type_info_joined WHERE metric = Years
public void printLongestShelfLife() {

    String qry = "SELECT min, MAX(max), metric FROM view_shelf_lives_and_type_info_joined WHERE metric = ?";

    Cursor c = db.rawQuery(qry, new String[]{"Years"});

    c.moveToFirst();

    Log.d("LongestShelfLife", c.getInt(0) + " - " + c.getInt(1)
            + " " + c.getString(2));

    c.close();

}

This was the resulting log statement:

D/LongestShelfLife: 8 - 10 Years

Since the longest shelf-life that exists is 10 years, I set the range of selectable years to 10 years prior and 10 years post the current year.

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. Select a random date.
  5. Press 'Accept'.

Confirm that the item and date is still being properly sent to the next fragment and that the prior years are now a selectable option.

NOTES

  • Added a dedicated "UPC" label
  • Converted PopupMenus to NumberPickers to prevent extremely long PopupMenus
  • Fixed issue #224 (closed)
  • Cleaned-up layout and fragment code

RELEVANT SCREENSHOTS

Here is a screenshot of the new layout design:

Screenshot_1625009653_resized

LABELS

NEST component:check-expiration-date type::bug type::enhancement status::done

Edited by Tyler Sizse

Merge request reports