Skip to content
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

feat: maintenance calculations #134

Merged
merged 11 commits into from
Nov 22, 2024
Merged

feat: maintenance calculations #134

merged 11 commits into from
Nov 22, 2024

Conversation

zz-hh-aa
Copy link
Collaborator

This PR uses #130 as base (that handles the UI, this handles the calculations).

What does this PR do?

  • Updates instances of maintenanceSpend to maintenancePercentage for clarity
  • Adds maintenancePercentage to relevant schemas and tests
  • Creates a new function createForecastParameters() to overwrite DEFAULT_FORECAST_PARAMETERS with user input maintenance spend percentage

Closes #133.

Copy link

vercel bot commented Oct 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fairhold-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 22, 2024 10:51am

* @param maintenancePercentage - Maintenance spend value from form ("0.015" | "0.02" | "0.0375")
* @returns ForecastParameters with updated maintenance cost
*/
export function createForecastParameters(maintenancePercentage: string): ForecastParameters {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's probably scope to simplify a fair few things in this PR by making sure that maintenancePercentage (and MAINTENANCE_LEVELS) are numbers at all times.

Even if it's a string value in the input, we can use Zod to refine it to a number for submission, and then keep it as a number going forward in out codebase.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah great catch, I think I've just pushed a fix for this now.

Base automatically changed from oz/maintenance to main November 7, 2024 16:56
for ForecastParameters file
@zz-hh-aa zz-hh-aa merged commit 7a77fa7 into main Nov 22, 2024
5 checks passed
@zz-hh-aa zz-hh-aa deleted the oz/maintenance-calculations branch November 22, 2024 10:59
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.

Add input for maintenance
2 participants