Skip to content

Conversation

v-lerie
Copy link
Collaborator

@v-lerie v-lerie commented Jul 14, 2025

Description

Fixes #2601

Screenshots

image

Copy link

vercel bot commented Jul 14, 2025

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

Name Status Preview Comments Updated (UTC)
policyengine-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 0:13am

Copy link
Collaborator

@anth-volk anth-volk left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this @v-lerie, just had a few changes for you.

? impact.budget[item.budgetKey]
: item.formula(impact.budget),
item.budgetKey === "benefit_spending_impact"
? -Math.abs(impact.budget[item.budgetKey])
Copy link
Collaborator

Choose a reason for hiding this comment

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

issue, blocking: I believe this only half-solves the problem

In cases where the government budget loses revenue (e.g., a new benefit program is introduced), the benefits row should be negative, but in cases where the government budget gains revenue (e.g., benefit cuts), it should be positive. This code will always make it positive.

? impact.budget[item.budgetKey]
: item.formula(impact.budget),
item.budgetKey === "benefit_spending_impact"
? -Math.abs(impact.budget[item.budgetKey])
Copy link
Collaborator

Choose a reason for hiding this comment

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

issue, blocking: It's tough to read this nested conditional

Addressing my other comment, can you modify this to be more readable/CLEAN?

}

if (budgetKey === "benefit_spending_impact") {
impact = -Math.abs(impact);
Copy link
Collaborator

Choose a reason for hiding this comment

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

issue, blocking: Here, too budgetary impacts are always negative when they should be negative only sometimes

@github-project-automation github-project-automation bot moved this from Todo to PR: Review Requested in policyengine-app Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: PR: Review Requested
Development

Successfully merging this pull request may close these issues.

Set benefit increases to negative values in net revenue impact 5y table
2 participants