Skip to content

Add Product Performance Report with percentage validation and dual view modes#568

Merged
StuartFerguson merged 5 commits intomainfrom
copilot/add-product-performance-report
Jan 8, 2026
Merged

Add Product Performance Report with percentage validation and dual view modes#568
StuartFerguson merged 5 commits intomainfrom
copilot/add-product-performance-report

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 8, 2026

Product Performance Report Implementation - COMPLETE ✅

Acceptance Criteria

  • Contribution percentages sum to 100%
  • Product totals reconcile with transaction data

Data Requirements

  • Product Name
  • Transaction count
  • Transaction value
  • Percentage contribution to total value

Output / Visualization

  • Grid view with detailed data table
  • Optional chart view for visual representation
  • Easy toggle between views

Implementation Details

  • Create ProductPerformanceModel in BlazorServer/Models/Models.cs
  • Add GetProductPerformanceQuery to BusinessLogic Queries.cs
  • Add IRequestHandler for GetProductPerformanceQuery in ReportingRequestHandler.cs
  • Create mock implementation (similar to MerchantTransactionSummary)
  • Implement ProductPerformance.razor page with:
    • Grid view showing product name, transaction count, transaction value, percentage contribution
    • Summary KPIs showing total products, total transactions, total value
    • Chart view toggle (optional visualization)
    • Ensure percentages sum to 100%
    • Ensure product totals reconcile with transaction data
    • Visual progress bars in grid view
    • Validation message confirming percentage sum
  • Add test infrastructure for ProductPerformanceQuery
  • Address code review feedback
    • Make ProductName nullable
    • Add protection against negative percentage values
  • Fix date range filtering
    • Data now varies based on selected date range
    • Longer periods show higher transaction volumes
  • Security considerations addressed
    • No SQL injection risks
    • Blazor XSS protection in place
    • Proper input validation
  • Documentation completed

Summary

Successfully implemented a comprehensive Product Performance Report that displays transaction performance metrics per product. The implementation includes:

  • Full UI with grid and chart views
  • 4 summary KPIs (total products, transactions, value, average)
  • Date range filtering with data that varies by period
  • Percentage validation ensuring 100% total
  • Visual progress bars for quick comparison
  • Empty, loading, and error states
  • Consistent with existing report patterns
  • Full test infrastructure support
Original prompt

This section details on the original issue you should resolve

<issue_title>Product Performance Report</issue_title>
<issue_description>Description: Show transaction performance metrics per product.
Business Value: Helps identify high- and low-performing products.

Data Requirements

  • Product Name
  • Transaction count
  • Transaction value
  • Percentage contribution to total value

Output / Visualization

  • Grid with optional chart view.

Acceptance Criteria

  • Contribution percentages sum to 100%.
  • Product totals reconcile with transaction data.</issue_description>

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 8, 2026 16:10
- Create ProductPerformanceModel with required fields
- Add GetProductPerformanceQuery to Queries
- Implement handler in ReportingRequestHandler with mock data
- Add TestMediatorService support for testing
- Implement ProductPerformance.razor page with grid and chart views
- Include KPIs and percentage validation

Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
- Make ProductName nullable for consistency
- Add Math.Max protection against negative percentage values
- Add comments explaining percentage calculation protection

Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Copilot AI changed the title [WIP] Add product performance report with metrics Add Product Performance Report with percentage validation and dual view modes Jan 8, 2026
Copilot AI requested a review from StuartFerguson January 8, 2026 16:21
@StuartFerguson
Copy link
Copy Markdown
Member

@copilot one comment, when changing the dates the numbers dont refresh, is that a UI bug or the test data ?

- Use date range as seed for Random to generate varying data
- Scale transaction counts and values based on date range length
- Consistent implementation in both TestMediatorService and ReportingRequestHandler
- Now changing dates will show different transaction volumes

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

Copilot AI commented Jan 8, 2026

@copilot one comment, when changing the dates the numbers dont refresh, is that a UI bug or the test data ?

Fixed in commit 5f2cd8d. The issue was in the test data implementation - both GetMockProductPerformance methods were using a fixed seed (42) for the Random generator, causing the same data to be generated regardless of date changes.

Changes made:

  • Now uses the date range (StartDate ^ EndDate) as the seed, so different date ranges produce different data
  • Scales transaction counts and values based on the date range length (30-day baseline)
  • Longer periods now show proportionally higher transaction volumes
  • Shorter periods show lower volumes

Example: Selecting last 7 days will show ~1/4 the transaction volume of a 30-day period, and selecting 60 days will show ~2x the volume.

@StuartFerguson StuartFerguson marked this pull request as ready for review January 8, 2026 16:41
@StuartFerguson StuartFerguson merged commit 767d242 into main Jan 8, 2026
4 of 5 checks passed
@github-actions github-actions Bot deleted the copilot/add-product-performance-report branch March 10, 2026 00:58
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.

Product Performance Report

2 participants