Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixes an issue where multiple jump links appear in an article's workflow nav when it has been moved through the workflow in a non linear fashion #4022

Merged
merged 2 commits into from
Mar 19, 2024

Conversation

ajrbyers
Copy link
Member

As workflow_stages is used elsewhere I've opted to add a new method that explicitly returns distinct WorkflowElements. This will also reduce the number of queries run as the template will no longer be fetching related items.

Closes #3593

… rather than using stages, will also reduce the number of queries.
@ajrbyers ajrbyers requested review from mauromsl and joemull March 13, 2024 15:36
Comment on lines 1683 to 1691
workflow_element_ids = core_models.WorkflowLog.objects.filter(
article=self,
).values_list(
'element'
).distinct()

return core_models.WorkflowElement.objects.filter(
pk__in=[element_id[0] for element_id in workflow_element_ids]
)
Copy link
Member

Choose a reason for hiding this comment

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

Super minor nitpick:

Can be a bit more compact with:

WorkflowElement.objects.filter(
    pk__in=article.workflowlog_set.values_list("element").distinct()
)

@mauromsl
Copy link
Member

Super minor optional comment inline but good to merge

@ajrbyers ajrbyers merged commit 4218c13 into master Mar 19, 2024
1 check was pending
@ajrbyers ajrbyers deleted the 3593-distinct_elements branch March 19, 2024 10:05
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Moving articles non-linearly through the workflow causes navigation dupes
3 participants