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: update Fairhold formula with new linear one #145

Merged
merged 3 commits into from
Nov 22, 2024

Conversation

zz-hh-aa
Copy link
Collaborator

What does this PR do?

  • Changes old cosine formula into updated linear one
    • Hardcoded the parameters in the formula as I don't think we will be changing them or need them to be saved as constants externally (which we did before)
  • Updates the tests accordingly

Why?

  • For the sake of simplicity, Alastair updated the Fairhold discount formula.

@zz-hh-aa zz-hh-aa requested a review from DafyddLlyr November 22, 2024 11:32
Copy link

vercel bot commented Nov 22, 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 3:38pm

math.cos((2 * math.pi * this.affordability) / this.length) +
this.position;

const discountLand = math.max(-1.1 * this.affordability + 0.7, 0.15)
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 it would still be worth making these magic numbers constants, just for documentation and readability.

I agree if they're not variables, we don't need to pass them into the class or have them as properties.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense, forgot about that whole readability thing! New commit should take care of this.

@@ -16,7 +21,7 @@ export class Fairhold {
}

private calculateFairholdDiscount() {
const discountLand = math.max(-1.1 * this.affordability + 0.7, 0.15)
const discountLand = math.max(MULTIPLIER * this.affordability + OFFSET, PLATEAU)
Copy link
Contributor

Choose a reason for hiding this comment

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

Much nicer!

@zz-hh-aa zz-hh-aa merged commit 0d36034 into main Nov 22, 2024
5 checks passed
@zz-hh-aa zz-hh-aa deleted the oz/linear-fh-formula branch November 22, 2024 16:57
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.

2 participants