Skip to content

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
ajrbyers merged 2 commits into
masterfrom
3593-distinct_elements
Mar 19, 2024
Merged

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
ajrbyers merged 2 commits into
masterfrom
3593-distinct_elements

Conversation

@ajrbyers

Copy link
Copy Markdown
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 joemull and mauromsl March 13, 2024 15:36
Comment thread src/submission/models.py Outdated
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
Copy Markdown
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
Copy Markdown
Member

Super minor optional comment inline but good to merge

@ajrbyers ajrbyers merged commit 4218c13 into master Mar 19, 2024
@ajrbyers ajrbyers deleted the 3593-distinct_elements branch March 19, 2024 10:05
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.

Moving articles non-linearly through the workflow causes navigation dupes

3 participants