Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for a new “Analysis” report type, including routing, data models, form services, and a suite of Angular components for dashboard, setup, and report rendering.
- Introduces
AnalysisReportSetupin the shared models and integrates it intoIdbAccountReport - Adds new routes for
analysisunder account reports and extends theReportTypeunion - Implements a full set of Angular components (dashboard, setup, report, facility report, problems info, data validation) and updates services/modules accordingly
Reviewed Changes
Copilot reviewed 35 out of 37 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/app/routing/account.routes.ts | Added imports and routes for analysis report and dashboard |
| src/app/models/overview-report.ts | Defined new AnalysisReportSetup interface |
| src/app/models/idbModels/accountReport.ts | Integrated analysisReportSetup into IdbAccountReport and default initializer |
| src/app/models/constantsAndTypes.ts | Extended ReportType to include 'analysis' |
| src/app/account/account-reports/account-reports.service.ts | Updated form builders and validation logic for analysis reports |
Comments suppressed due to low confidence (2)
src/app/account/account-reports/account-reports.service.ts:47
- The
else ifbranches for specialized report types (betterPlants/analysis/etc.) appear after thereturnstatement, making them unreachable. Please refactor so that form selection logic occurs before any return.
getSetupFormFromReport(report: IdbAccountReport): FormGroup {
src/app/account/account-reports/report-pipes/account-report-type.pipe.ts:10
- There is no default/fallback return path if
reportTypedoesn't match any case, so the function may returnundefined. Add a finalelseordefaultcase that returns a valid string or throws.
transform(reportType: ReportType): 'Better Plants' | 'Data Overview' | 'Performance' | 'Better Climate Report' | 'Analysis' {
| this.initializeGroups(); | ||
| } | ||
|
|
||
| initializeGroups() { |
There was a problem hiding this comment.
The method pushes into executiveSummaryItems without clearing it first, causing duplicates on repeated calls. Consider resetting this.executiveSummaryItems = [] at the start of this method.
| initializeGroups() { | |
| initializeGroups() { | |
| this.executiveSummaryItems = []; |
| </div> | ||
| </div> | ||
|
|
||
| <app-print-report-button *ngIf="facilityDetails"></app-print-report-button> No newline at end of file |
There was a problem hiding this comment.
Using *ngIf="facilityDetails" will always be truthy once defined, even if the array is empty. Consider using *ngIf="facilityDetails.length > 0" to hide the button when there is no data.
| <app-print-report-button *ngIf="facilityDetails"></app-print-report-button> | |
| <app-print-report-button *ngIf="facilityDetails.length > 0"></app-print-report-button> |
|
I think overall I'm happy with how this has turned out. I do have two notes on UI related stuff, not code related:
|
connects #1921 #1552 #1306