Streamline the canonicalize group workflow#373
Streamline the canonicalize group workflow#373offbyone merged 1 commit intoWorldconVotingSystems:mainfrom
Conversation
3b0eba0 to
6e60422
Compare
|
|
||
| def __str__(self): | ||
| return f"{self.proposed_work_name()} in {self.category}" | ||
| return f"{self.proposed_work_name()} ({self.category})" |
There was a problem hiding this comment.
This will appear in way more places than just this form; I think I'll skip this part of the change.
offbyone
left a comment
There was a problem hiding this comment.
There's a change that is needed
| 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"]: | ||
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
)There was a problem hiding this comment.
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.
6e60422 to
8be4286
Compare
| </style> | ||
| {% endblock %} | ||
|
|
||
| {% block action_form %} |
There was a problem hiding this comment.
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.
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.