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

Hot-fix remove of invalid deciles in charts #2137

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/pages/policy/output/decile/AverageImpactByDecile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ export function ImpactPlot(props) {
export default function averageImpactByDecile(props) {
const { impact, policyLabel, metadata, mobile, useHoverCard = false } = props;
const decileAverage = impact.decile.average;

// Hot fix to be removed to avoid deciles outside of 1-10
Object.keys(decileAverage).forEach((key) => {
if (key > 10 || key < 1) {
delete decileAverage[key];
}
});

const averageChange =
-impact.budget.budgetary_impact / impact.budget.households;
const chart = (
Expand Down
8 changes: 8 additions & 0 deletions src/pages/policy/output/decile/RelativeImpactByDecile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ export function ImpactPlot(props) {
export default function relativeImpactByDecile(props) {
const { impact, policyLabel, metadata, mobile, useHoverCard = false } = props;
const decileRelative = impact.decile.relative;

// Hot fix to be removed to avoid deciles outside of 1-10
Object.keys(decileRelative).forEach((key) => {
if (key > 10 || key < 1) {
delete decileRelative[key];
}
});

const relativeChange =
-impact.budget.budgetary_impact / impact.budget.baseline_net_income;
const chart = (
Expand Down
Loading