Skip to content

Refactor GetTransactionSummaryByMerchantReport to reduce cyclomatic complexity#474

Merged
StuartFerguson merged 4 commits intomainfrom
copilot/refactor-transaction-summary-method
Feb 27, 2026
Merged

Refactor GetTransactionSummaryByMerchantReport to reduce cyclomatic complexity#474
StuartFerguson merged 4 commits intomainfrom
copilot/refactor-transaction-summary-method

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 27, 2026

  • Refactor GetTransactionSummaryByMerchantReport in ReportingManager.cs to reduce method length below 50 lines
    • Add private sealed class MerchantTransactionGroupProjection for the intermediate query result
    • Add private sealed class MerchantTransactionFinalProjection for the final query result
    • Extract BuildMerchantTransactionBaseQuery private static helper method
    • Extract BuildMerchantTransactionFinalQuery private static helper method
    • Simplified main method body to use the new helper methods (reduced from ~83 to ~44 lines)
  • Fixed build error: missing closing brace } for MerchantTransactionFinalProjection class caused by merge conflict resolution from main
Original prompt

This section details on the original issue you should resolve

<issue_title>[Complexity] Method ReportingManager::GetTransactionSummaryByMerchantReport has 96 lines of code (limit is 50)</issue_title>
<issue_description>

Codacy ID: c6859b674165e0c220787e001f8c7381

File: EstateReportingAPI.BusinessLogic/ReportingManager.cs
Line: 752
Rule: Complexity (Warning)
Commit: 157eaa6a54cd58196a9963e70e66cb25c6c2873a

Message: Method ReportingManager::GetTransactionSummaryByMerchantReport has 70 lines of code (limit is 50)

**Code Snippet:**
```csharp
    public async Task<Result<TransactionSummaryByMerchantResponse>> GetTransactionSummaryByMerchantReport(TransactionQueries.TransactionSummaryByMerchantQuery request, 
```

</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…h below 50 lines

Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor ReportingManager::GetTransactionSummaryByMerchantReport method Refactor GetTransactionSummaryByMerchantReport to reduce cyclomatic complexity Feb 27, 2026
@StuartFerguson StuartFerguson marked this pull request as ready for review February 27, 2026 20:33
@StuartFerguson
Copy link
Copy Markdown
Member

@copilot can you fix the build error please

…s after merge conflict

Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 27, 2026

@copilot can you fix the build error please

Fixed in fbe33e1. The merge from main introduced a missing closing brace } for the MerchantTransactionFinalProjection class — TransactionDetailQueryResult (added in main) was inserted directly inside it without proper class separation.

@StuartFerguson StuartFerguson merged commit 882ef07 into main Feb 27, 2026
8 checks passed
@github-actions github-actions Bot deleted the copilot/refactor-transaction-summary-method branch April 29, 2026 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Complexity] Method ReportingManager::GetTransactionSummaryByMerchantReport has 96 lines of code (limit is 50)

2 participants