Skip to content

Streamline the canonicalize group workflow#373

Merged
offbyone merged 1 commit intoWorldconVotingSystems:mainfrom
aJanuary:improve-canonicalization-workflow
Mar 28, 2026
Merged

Streamline the canonicalize group workflow#373
offbyone merged 1 commit intoWorldconVotingSystems:mainfrom
aJanuary:improve-canonicalization-workflow

Conversation

@aJanuary
Copy link
Copy Markdown
Contributor

@aJanuary aJanuary commented Mar 27, 2026

Customize the group nominations action form to make it possible to: 1) Select which of the new works to use as the new canonicalized for 2) Search for existing canonicalized forms

Also show more than 1 potential match for existing canonicalized forms, allowing for fuzzier matching.

image

@aJanuary aJanuary force-pushed the improve-canonicalization-workflow branch 2 times, most recently from 3b0eba0 to 6e60422 Compare March 28, 2026 11:24
Comment thread src/nomnom/nominate/models.py Outdated

def __str__(self):
return f"{self.proposed_work_name()} in {self.category}"
return f"{self.proposed_work_name()} ({self.category})"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will appear in way more places than just this form; I think I'll skip this part of the change.

Copy link
Copy Markdown
Contributor

@offbyone offbyone left a comment

Choose a reason for hiding this comment

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

There's a change that is needed

Comment thread src/nomnom/canonicalize/models.py Outdated
Comment on lines +46 to +53
results = cls.find_matches_for_nomination(name, category, limit=1)
return results[0] if results else None

@classmethod
def find_matches_for_nomination(
cls, name: str, category: "nominate.Category", limit: int = 3
) -> list["Work"]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can't re-use this in this way. The call chain to here is in the Nomination save flow, which means that this will be possibly linking non-exact matches as well.

This has to be a separate feature.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's invoked from here:

@receiver(post_save, sender=nominate.Nomination)
def link_work_to_nomination(sender, instance, created, **kwargs):
    ...
    work = Work.find_match_based_on_identical_nomination(
        instance.proposed_work_name(), instance.category
    )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops, good catch. I have changed it to be a new method.

Customize the group nominations action form to make it possible to:
1) Select which of the new works to use as the new canonicalized for
2) Search for existing canonicalized forms

Also show more than 1 potential match for existing canonicalized forms,
allowing for fuzzier matching.
@aJanuary aJanuary force-pushed the improve-canonicalization-workflow branch from 6e60422 to 8be4286 Compare March 28, 2026 19:17
</style>
{% endblock %}

{% block action_form %}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After your question about the form attribute I realized that I don't actually need to be putting the "Create from a Raw Nomination" and "Suggested Canonical Works" in the content block anymore. That was leftover from when I was still trying to figure out how to get things working. So I've moved them all into the action_form block, and inside the form in a more traditional manner.

@aJanuary aJanuary requested a review from offbyone March 28, 2026 19:20
@offbyone offbyone merged commit 6559716 into WorldconVotingSystems:main Mar 28, 2026
5 checks passed
@offbyone offbyone added the minor PRs that should result in a minor version bump (new small features) label Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor PRs that should result in a minor version bump (new small features)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants