Skip to content

Conversation

@itsmostafa
Copy link
Collaborator

Summary

Converts the usp_getVADRSummaryOverall stored procedure to an async LINQ query, following the same pattern established in PR #5244 for usp_getFirstPage. This improves code maintainability by keeping query logic in the application layer and enables better testability.

Commits

  • 023824eb4 feat(business): add LINQ equivalent for usp_getVADRSummaryOverall
  • b8781a4cd refactor(api): update VADR endpoint to use async LINQ method
  • 26d52f333 chore(datalayer): remove usp_getVADRSummaryOverall stored procedure wrapper
  • 3c5488f7a chore(db): add migration to drop usp_getVADRSummaryOverall

Changes

  • Added async GetSummaryOverallAsync method in VADRReports.cs using LINQ with EF Core best practices:
    • Uses AsNoTracking() for read-only query performance
    • Filters parent questions only (excludes child freeform text questions)
    • Projects only needed columns from lookup tables
    • Calculates answer counts and percentages in-memory
  • Updated GetVADRDetailReport endpoint to async to support the new method
  • Removed stored procedure wrapper from CsetwebContextProcedures.cs
  • Removed interface declaration from ICsetwebContextProcedures.cs
  • Deleted orphaned result class usp_getVADRSummaryOverallResult.cs
  • Updated efpt.config.json to remove stored procedure reference
  • Added SQL migration to drop the stored procedure from the database

Breaking Changes

None

Test Plan

  • Run task test:backend to verify all backend tests pass
  • Run task build:backend to verify build succeeds
  • Test VADR report generation in the application to ensure data displays correctly
  • Verify answer counts and percentages match expected values

Related Issues

None

Release Notes

Improved code maintainability by converting the VADR summary stored procedure to a LINQ query, enabling better testability and keeping query logic in the application layer.

Checklist

  • Tests pass locally (task test:backend)
  • Build succeeds (task build:backend)
  • Linting passes (task lint:backend)
  • Conventional commit format followed

Replace stored procedure call with async LINQ query that:
- Filters parent questions only (excludes child freeform text questions)
- Uses AsNoTracking() for read-only query performance
- Projects only needed columns from lookup tables
- Calculates answer counts and percentages in-memory
Update GetVADRDetailReport endpoint to async and call
GetSummaryOverallAsync instead of stored procedure method.
…rapper

- Remove async method from CsetwebContextProcedures
- Remove interface declaration from ICsetwebContextProcedures
- Delete orphaned result class usp_getVADRSummaryOverallResult
- Remove stored procedure from EF Power Tools config
Add SQL to drop stored procedure in database upgrade script
since it has been replaced with LINQ equivalent.
@itsmostafa itsmostafa self-assigned this Jan 5, 2026
@randywoods randywoods merged commit 2670293 into develop Jan 5, 2026
6 checks passed
@randywoods randywoods deleted the refactor/convert-usp-getvadrsummaryoverall-to-linq branch January 5, 2026 17:50
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