Skip to content

[Customer Portal[BE] Fix active counts to include change requests - #336

Merged
Rashmika998 merged 2 commits into
wso2-open-operations:customer-portal-milestone-1from
Rashmika998:customer-portal-milestone-1-projects
Mar 13, 2026
Merged

Rashmika998 merged 2 commits into
wso2-open-operations:customer-portal-milestone-1from
Rashmika998:customer-portal-milestone-1-projects

Conversation

@Rashmika998

@Rashmika998 Rashmika998 commented Mar 13, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR updates the active counts logic to include change request–related counts in addition to the existing metrics.

Changes

  • Extended active count calculations to include change request counts
  • Updated response models/DTOs to return the additional metrics
  • Adjusted service-layer aggregation logic
  • Ensured consistent serialization and response formatting

Reason

Previously, the active counts only reflected case-related activity. Including change request counts provides a more complete view of active work items and improves dashboard reporting and monitoring.

Testing

  • Verified active counts include change request data
  • Tested aggregation logic with different datasets
  • Confirmed correct behavior when no change requests are present
  • Performed regression testing on stats-related endpoints

Impact

  • Response structure extended (non-breaking addition)
  • No changes to request payload

Summary by CodeRabbit

  • Bug Fixes
    • Improved case statistics accuracy by including change-request counts when present, yielding more reliable totals and active counts in project case reports.

@Rashmika998 Rashmika998 self-assigned this Mar 13, 2026
@Rashmika998 Rashmika998 added Type/Improvement Marks enhancements or improvements to existing features App/Customer Portal Area/Backend labels Mar 13, 2026
@coderabbitai

coderabbitai Bot commented Mar 13, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 50bf36bc-f18b-47d3-9dcd-98a04d2dd810

📥 Commits

Reviewing files that changed from the base of the PR and between 61ae68b and 95583bb.

📒 Files selected for processing (1)
  • apps/customer-portal/backend/utils.bal

📝 Walkthrough

Walkthrough

mapCaseStats's second parameter changes from an optional int to an optional ProjectChangeRequestStatsResponse; the service handler now passes the full change-request stats object when available. Mapping logic uses the object's totalCount and activeCount when provided.

Changes

Cohort / File(s) Summary
Stats mapping & handler
apps/customer-portal/backend/utils.bal, apps/customer-portal/backend/service.bal
Changed mapCaseStats(entity, int?) → mapCaseStats(entity, ProjectChangeRequestStatsResponse?). Caller now passes the full ProjectChangeRequestStatsResponse (or ()), and mapping uses totalCount/activeCount from that object when present.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • cloby99
  • shayanmalinda

Poem

🐰
I hopped through code with eager paws,
Now whole stats travel, not just the cause.
Totals and actives, side by side,
A cleaner pass — I nibbled with pride. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description provides a clear explanation of changes, reason, and testing performed, but does not follow the required template structure with all mandatory sections. Follow the repository's PR description template to include Purpose (with issue links), Goals, Approach, User Stories, Release Notes, and other required sections for complete documentation.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: extending active counts to include change request statistics in the customer portal backend.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/customer-portal/backend/utils.bal (1)

373-376: Update parameter documentation to reflect expanded usage.

The docstring for changeReqStats states it is used for "total interactions", but the parameter is now also used to augment activeCount (line 399). Consider updating the doc comment.

-# + changeReqStats - Count of change requests to be added to total interactions
+# + changeReqStats - Change request stats to be added to total interactions and active count
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/customer-portal/backend/utils.bal` around lines 373 - 376, The doc
comment for the mapCaseStats function incorrectly describes the changeReqStats
parameter as only being used to "Count of change requests to be added to total
interactions"; update the parameter documentation for changeReqStats in the
mapCaseStats docstring to state it is used both to add to total interactions and
to augment activeCount (used when computing active cases), referencing the
function name mapCaseStats and the changeReqStats parameter so future readers
know both uses.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/customer-portal/backend/utils.bal`:
- Around line 373-376: The doc comment for the mapCaseStats function incorrectly
describes the changeReqStats parameter as only being used to "Count of change
requests to be added to total interactions"; update the parameter documentation
for changeReqStats in the mapCaseStats docstring to state it is used both to add
to total interactions and to augment activeCount (used when computing active
cases), referencing the function name mapCaseStats and the changeReqStats
parameter so future readers know both uses.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 99fe5651-59e1-49b7-b4b3-a9918c067f10

📥 Commits

Reviewing files that changed from the base of the PR and between 11f26fb and 61ae68b.

📒 Files selected for processing (2)
  • apps/customer-portal/backend/service.bal
  • apps/customer-portal/backend/utils.bal

@Rashmika998
Rashmika998 requested a review from cloby99 March 13, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App/Customer Portal Area/Backend Type/Improvement Marks enhancements or improvements to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants