Skip to content

FIX: #13846: General task not retrieved - #13870

Closed
Pa-Touche wants to merge 2 commits into
developmentfrom
fix/13846-missing-general-tasks
Closed

FIX: #13846: General task not retrieved#13870
Pa-Touche wants to merge 2 commits into
developmentfrom
fix/13846-missing-general-tasks

Conversation

@Pa-Touche

@Pa-Touche Pa-Touche commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #13846

Summary by CodeRabbit

  • Bug Fixes

    • Task lists filtered by region or district now also include tasks marked with the general context, so searches return more complete and expected results.
  • Tests

    • Added automated test coverage to verify retrieval and filtering of general-context tasks within regional and district scopes.

@coderabbitai

coderabbitai Bot commented Mar 9, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6f70e7e1-9b17-41c2-9bf2-32fd95d9d6dd

📥 Commits

Reviewing files that changed from the base of the PR and between aa356b8 and 2738273.

📒 Files selected for processing (1)
  • sormas-backend/src/test/java/de/symeda/sormas/backend/task/TaskFacadeEjbTest.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • sormas-backend/src/test/java/de/symeda/sormas/backend/task/TaskFacadeEjbTest.java

📝 Walkthrough

Walkthrough

When building task query filters, region- and district-based OR predicates were extended to also require tasks to have TaskContext.GENERAL. A unit test was added to verify that GENERAL-context tasks scoped to a region/district appear in task directory queries.

Changes

Cohort / File(s) Summary
Task Service Filter Logic
sormas-backend/src/main/java/de/symeda/sormas/backend/task/TaskService.java
Updated buildCriteriaFilter: OR branches for region and district now additionally require TaskContext.GENERAL, so general-context tasks are included in region/district filtering.
Task Query Tests
sormas-backend/src/test/java/de/symeda/sormas/backend/task/TaskFacadeEjbTest.java
Added imports and new test testTaskDirectoryForGeneralTasks() that creates a GENERAL task in a region/district context and asserts it is returned by task directory queries filtered by region/district and status.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through filters, soft and small,
Found GENERAL tasks beyond the wall,
I nudged the logic, fixed a seam,
Now directory lists show every team,
A little hop — and all's well seen. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly identifies the issue being fixed (#13846) and accurately summarizes the main problem: general tasks not being retrieved.
Description check ✅ Passed Description includes the required issue reference (Fixes #13846) and follows the template structure, though it lacks additional context about the changes.
Linked Issues check ✅ Passed The changes address the core requirement: general tasks created in the task directory now appear in the task list by filtering properly in buildCriteriaFilter.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the general task retrieval issue: modifications to TaskService filtering logic and comprehensive test coverage.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/13846-missing-general-tasks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@sormas-backend/src/test/java/de/symeda/sormas/backend/task/TaskFacadeEjbTest.java`:
- Around line 123-149: The test testTaskDirectoryForGeneralTasks in
TaskFacadeEjbTest currently calls getIndexList(new
TaskCriteria().taskContext(TaskContext.GENERAL).taskStatus(TaskStatus.DONE),
...) but does not set region or district so the new GENERAL-path in
TaskService.buildCriteriaFilter (which only runs when taskCriteria.getRegion()
!= null or getDistrict() != null) is not exercised; update the test to set
either taskCriteria.region(...) or taskCriteria.district(...) (use the created
rdcf.region/district UUIDs or their references) before calling getIndexList so
the TaskContext.GENERAL branch in buildCriteriaFilter is executed and the
assertion validates the fix.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5108336d-74b5-4005-96cf-d0b3a70456e1

📥 Commits

Reviewing files that changed from the base of the PR and between 2b09617 and aa356b8.

📒 Files selected for processing (2)
  • sormas-backend/src/main/java/de/symeda/sormas/backend/task/TaskService.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/task/TaskFacadeEjbTest.java

@sormas-vitagroup

Copy link
Copy Markdown
Contributor

1 similar comment
@sormas-vitagroup

Copy link
Copy Markdown
Contributor

@Pa-Touche Pa-Touche closed this Mar 11, 2026
@Pa-Touche

Copy link
Copy Markdown
Contributor Author

This naive implementation has one downside: general tasks will be retrieved BUT they will not be attached to region or district, therefore for countries actively using regions and districts all general tasks will be returned without able to distinguish between a district or region.

Those information could be added in the task entity for general tasks only

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.

No tasks show up in list of tasks when new task is created in task mgmt directory

2 participants