-
-
Notifications
You must be signed in to change notification settings - Fork 795
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
Handle Recipe Times as dicts and lists #2764
Handle Recipe Times as dicts and lists #2764
Conversation
Would there be any harm of just grabbing a the first value instead of returning Also, as long as we're in here, any chance you could tackle #2732 as well? Should be pretty much the same thing, just grab the first element if the list isn't empty |
Am not to sure about just returning the first element in the dict as we cannot be sure what that would be. First value would be "Duration" in this example and maxValue is 1485 min. So 2/3 have nothing to do with the actual time. Will implement the array 👍 Tho there are obviously the same risks as above. But i think the chance is lesser to find garbage data in there. |
Makes sense to me! |
#2732 seems to just run into the next error with image scraping because it is missing the domain. while i am in there, any thoughts on this? regarding turning the default case to none?
|
I think that makes sense, as you said it's nonessential. Maybe put a warning log in there just in case someone wants to raise an issue for it from mealie.core.root_logger import get_logger
logger = get_logger(__name__)
logger.warning(...) |
Otherwise PR LGTM! |
What type of PR is this?
What this PR does / why we need it:
Recipe times do come sometimes in form of a dict. This parses the dict if it contains an minValue and returns this. This mimiques the recipe scraper which impelemts this here.
Which issue(s) this PR fixes:
fixes #2753
fixes #2732
Special notes for your reviewer:
I decided to return None instead of the TypeError if the minValue entry is not present. This will continue the scraping and allow the recipe to be imported.
We might think of doing the same for the default case. I think the total, prep and cook times are non essential to an recipe and important times usually are stated within the recipe. If we return None istead of raising an type error this would just remove those fields and will create the recipe without them.
Testing
Manual testing, can write a test case for this if desired.