- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 829
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: Changed Recipe's Last Made button to allow editing Last Made Date. #4986
base: mealie-next
Are you sure you want to change the base?
feat: Changed Recipe's Last Made button to allow editing Last Made Date. #4986
Conversation
…ded styles for the hover.
max-width="290px" | ||
min-width="auto" | ||
> | ||
<template #activator="{ on, attrs }"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation went a bit wonky!
// If lastMade exists, init the date picker to that date, else set to 'today' | ||
lastMadeEdit.value = lastMade.value | ||
? new Date(lastMade.value).toISOString().substring(0, 10) | ||
: new Date().toISOString().substring(0, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just do new Date(lastMade.value).toISOString().substring(0, 10)
; because if it's null it'd back back to current date? (or pull the bit that is different - last edited || now) out to DRY?
@@ -459,7 +459,8 @@ def update_last_made(self, slug: str, data: RecipeLastMade): | |||
"""Update a recipe's last made timestamp""" | |||
|
|||
try: | |||
recipe = self.service.update_last_made(slug, data.timestamp) | |||
# If timestamp is None, update with None | |||
recipe = self.service.update_last_made(slug, data.timestamp if data.timestamp is not None else None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't
recipe = self.service.update_last_made(slug, data.timestamp if data.timestamp is not None else None) | |
recipe = self.service.update_last_made(slug, data.timestamp) |
make more sense? If it's !!None, doesn't that mean it's None?
Seems mostly sensible; not having python as a daily driver the !!None thing seems a bit odd; but if it's idiomatic... great. |
Makes sense, thanks for that! Looking forward to having it merged |
There is currently no way of changing or removing the "last made" date.
Added option in the UI to do so.
Changed API to accept null for Last Made date so it can be set back to Never.
Which issue(s) this PR fixes:
Feature Request #4974
Special notes for your reviewer:
I added some styles to RecipeLastMade.vue, but I'm not sure this is the correct place to do so?