-
-
Notifications
You must be signed in to change notification settings - Fork 9
feat: add target recalculation functionality and UI controls for saving and resetting targets #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ng and resetting targets Also, fixed time savings chart to use configured targets & max values
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
| const totalPercent = userSurveys.reduce((sum, survey) => { | ||
| const percentTimeSaved = typeof survey.percentTimeSaved === 'number' ? survey.percentTimeSaved : 0; | ||
| // Always parse percentTimeSaved as float | ||
| const percentTimeSaved = survey.percentTimeSaved != null ? parseFloat(survey.percentTimeSaved as any) : 0; |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
| const hoursPerYear = typeof this.settings.hoursPerYear === 'number' ? this.settings.hoursPerYear : 2000; | ||
| const percentCoding = typeof this.settings.percentCoding === 'number' ? this.settings.percentCoding : 50; | ||
| // Convert settings values to numbers (parse from string if needed) | ||
| const hoursPerYear = this.settings.hoursPerYear != null ? parseFloat(this.settings.hoursPerYear as any) : 2000; |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
| const percentCoding = typeof this.settings.percentCoding === 'number' ? this.settings.percentCoding : 50; | ||
| // Convert settings values to numbers (parse from string if needed) | ||
| const hoursPerYear = this.settings.hoursPerYear != null ? parseFloat(this.settings.hoursPerYear as any) : 2000; | ||
| const percentCoding = this.settings.percentCoding != null ? parseFloat(this.settings.percentCoding as any) : 50; |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
|
|
||
| // Calculate max based on settings | ||
| const maxPercentTimeSaved = typeof this.settings.percentTimeSaved === 'number' ? this.settings.percentTimeSaved : 20; | ||
| const maxPercentTimeSaved = this.settings.percentTimeSaved != null ? parseFloat(this.settings.percentTimeSaved as any) : 20; |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
| // Ensure all values are properly typed as numbers | ||
| const hoursPerYear = typeof this.settings.hoursPerYear === 'number' ? this.settings.hoursPerYear : 2000; | ||
| // Always parse settings values as numbers (from string if needed) | ||
| const hoursPerYear = this.settings.hoursPerYear != null ? parseFloat(this.settings.hoursPerYear as any) : 2000; |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
| const weeksInYear = Math.round(hoursPerYear / 40) || 50; // Calculate weeks and ensure it's a number | ||
|
|
||
| const devCostPerYear = typeof this.settings.devCostPerYear === 'number' ? this.settings.devCostPerYear : 0; | ||
| const devCostPerYear = this.settings.devCostPerYear != null ? parseFloat(this.settings.devCostPerYear as any) : 0; |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
| // Convert hours per year to number | ||
| const hoursPerYear = typeof this.settings.hoursPerYear === 'number' ? this.settings.hoursPerYear : 2000; | ||
| // Always parse hours per year as number | ||
| const hoursPerYear = this.settings.hoursPerYear != null ? parseFloat(this.settings.hoursPerYear as any) : 2000; |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
|
|
||
| resetTargets() { | ||
| // Call the backend endpoint to recalculate targets | ||
| this.targetsService.recalculateTargets().subscribe((result: any) => { |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
|
|
||
| recalculateTargets() { | ||
| // Calls the backend endpoint to recalculate targets | ||
| return this.http.get<any>(`${this.apiUrl}/calculate`); |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
Also, fixed time savings chart to use configured targets & max values