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

Add a 'delete_tags' cfp task #1308

Merged
merged 2 commits into from
Jan 21, 2024
Merged

Add a 'delete_tags' cfp task #1308

merged 2 commits into from
Jan 21, 2024

Conversation

SamLR
Copy link
Member

@SamLR SamLR commented Jan 15, 2024

Because these will change and this way we can clean up

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):
Copy link
Contributor

Choose a reason for hiding this comment

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

drive-by nit

Suggested change
def Delete_tags(tags_to_delete):
def delete_tags(tags_to_delete):

Copy link
Member Author

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

app.logger.info(f"'{tag_name}' added to session.")

db.session.commit()
app.logger.info(f"Successfully created {tags_deleted} new tags.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
app.logger.info(f"Successfully created {tags_deleted} new tags.")
app.logger.info(f"Successfully deleted {tags_deleted} tags.")

Copy link
Member Author

Choose a reason for hiding this comment

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

done


@cfp.cli.command(
"delete_tags",
help=f"Delete tags from the Database. Any tagged proposals will have the tags removed.",
Copy link
Member

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?

Copy link
Member Author

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)

Copy link
Member

@marksteward marksteward Jan 15, 2024

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.

Copy link
Member Author

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}"

Copy link
Contributor

@lukegb lukegb left a 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
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}"
Copy link
Contributor

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)

Copy link
Member Author

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.

Copy link
Contributor

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!

@russss russss enabled auto-merge (rebase) January 21, 2024 14:18
@russss russss merged commit d8420dd into main Jan 21, 2024
2 checks passed
@russss russss deleted the create-delete-tags-task branch January 21, 2024 14:20
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.

5 participants