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: plural foods and units, and aliases #2674

Merged

Conversation

michael-genson
Copy link
Collaborator

@michael-genson michael-genson commented Oct 21, 2023

What type of PR is this?

(REQUIRED)

  • feature

What this PR does / why we need it:

(REQUIRED)

This PR adds plural names and aliases to foods and units (and a plural abbreviation for units). When parsing, the parser takes all names/abbreviations/aliases into account when matching against an input.

In addition, as you'd expect, foods/units conditionally render their plural counterparts, depending on the quantity and such:

  • 1 cup onion
  • 3 cups onions
  • 0 onions (the zero is omitted)
  • 3/4 cup onion
  • 2.5 cups onions

If a food or unit is missing its plural counterpart (i.e. everyone's data prior to this getting merged) it falls back to singular (i.e. on migration nothing will look any different).


The data management pages have been updated to accommodate these changes, along with some helpful hint text:

image

image

image

image

Which issue(s) this PR fixes:

(REQUIRED)

Closes #1242

Special notes for your reviewer:

(fill-in or delete this section)

Technically this adds several hundred tests... apparently you can chain pytest.mark.parametrize... lol. However none of them do anything expensive (such as database access) so they zoom.

Testing

(fill-in or delete this section)

Pytest for backend, updated composable for frontend (and manually tested).

@michael-genson
Copy link
Collaborator Author

Originally I was going to wait until #2632 was merged, but the data pages got reverted anyway so there shouldn't be any merge conflicts either way

@michael-genson michael-genson marked this pull request as ready for review October 28, 2023 03:55
@hay-kot hay-kot enabled auto-merge (squash) November 14, 2023 15:38
Copy link
Collaborator

@hay-kot hay-kot left a comment

Choose a reason for hiding this comment

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

LGTM

@hay-kot hay-kot merged commit d440d51 into mealie-recipes:mealie-next Nov 14, 2023
@michael-genson michael-genson deleted the feat/food-and-unit-aliases branch November 14, 2023 15:39
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.

[v1.0.0b] [Task] - Support for Plural and Alternate Names for Ingredients and Units
2 participants