-
Notifications
You must be signed in to change notification settings - Fork 84
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
Add a 'delete_tags' cfp task #1308
Conversation
apps/cfp/tasks.py
Outdated
help=f"Delete tags from the Database. Any tagged proposals will have the tags removed.", | ||
) | ||
@click.argument("tags_to_delete", required=True, nargs=-1) | ||
def Delete_tags(tags_to_delete): |
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.
drive-by nit
def Delete_tags(tags_to_delete): | |
def delete_tags(tags_to_delete): |
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.
not sure what happened there
apps/cfp/tasks.py
Outdated
app.logger.info(f"'{tag_name}' added to session.") | ||
|
||
db.session.commit() | ||
app.logger.info(f"Successfully created {tags_deleted} new tags.") |
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.
app.logger.info(f"Successfully created {tags_deleted} new tags.") | |
app.logger.info(f"Successfully deleted {tags_deleted} tags.") |
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.
done
apps/cfp/tasks.py
Outdated
|
||
@cfp.cli.command( | ||
"delete_tags", | ||
help=f"Delete tags from the Database. Any tagged proposals will have the tags removed.", |
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.
I guess "Any tagged proposals will have the tags removed" was a first draft?
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.
no, the tags have got the correct cascade setting so deleting the tag removes it from the list (at least that's what local testing did)
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.
Ahh, I read a return
that isn't there. Maybe it should say something like f"'{tag_name}' will be removed from the following proposals: {tagged_proposals}" on line 172.
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.
Good point, :172 is now? f"'{tag_name}' will be removed from the proposals with ids: {tagged_proposals}"
02d569b
to
be4982c
Compare
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.
LGTMBWDIK (looks good to me, but what do I know)
Because these will change and this way we can clean up
be4982c
to
e4c2fb4
Compare
if tag.proposals: | ||
tagged_proposals = [p.id for p in tag.proposals] | ||
app.logger.info( | ||
f"'{tag_name}' will be removed from the proposals with ids: {tagged_proposals}" |
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.
Nitpicky: would it be helpful to mention each proposal title
as well? (thinking: could provide a useful sense-check during tag removal)
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.
probably not? This will hopefully be a pretty rare manual task (after I do what I need to do which is update the current list of tags to match those selected by the content team) and untagged proposals can be found via the UI.
In theory deleting a tag will only happen when it's not useful: i.e. has very few (probably no) members OR so many members it's pointless.
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.
Okie doke, just checking. Seems reasonable!
Because these will change and this way we can clean up