Skip to content

Conversation

@zouharvi
Copy link
Contributor

This hijacks the campaign-status page for ESA which now has different requirements.

image

This is not bad per-se. The one real bad thing is finding all the assigned items. I've been unable to locate the assigned task otherwise (task.assignedTo and task.createdBy doesn't work)

The offending code:

                total_count = None
                _data_all = DirectAssessmentDocumentTask.objects.filter(campaign=campaign.id)
                # brute-force try to find if any task has at least one item annotated by this user
                for task in _data_all:
                    for item in task.items.all():
                        item = DirectAssessmentDocumentResult.objects.filter(
                            item=item, createdBy=user
                        ).last()
                        if item:
                            total_count = task.items.count()
                            break
                    if total_count:
                        break

The DirectAssessmentDocumentTask.get_task_for_user(..) sounds like it should do exactly what we want but it just returns None (because assignedTo is always None).

@snukky
Copy link
Contributor

snukky commented Jul 26, 2025

Let me take a look tomorrow morning. If I don't find a more efficient way for finding all assigned items, at least we have something that works, so no worries :)

@zouharvi
Copy link
Contributor Author

The previous commit improves the styling:
image

Also I found a better way to get the task. It's equally silly but seems to be working. Essentially get the task from the first item of annotated data, so we can use the following which is at least not slow.

task = DirectAssessmentDocumentTask.objects.filter(id=_data[0].task_id).first()

Still, it would be good to find out why the tasks don't have assignedTo set to anything.

(the other change in the direct_assessment_document.py is unrelated but it's something that I left over at WMT24 and only now got an idea how to speed up at least)

zouharvi and others added 3 commits July 25, 2025 20:03
@snukky
Copy link
Contributor

snukky commented Jul 26, 2025

My guess is that assignedTo isn't assigned because it's an obsolete code and now TaskAgenda is responsible for mapping tasks and accounts.

@snukky snukky merged commit 1118cf2 into develop Jul 26, 2025
3 checks passed
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.

3 participants