Skip to content

Commit

Permalink
Merge pull request #2137 from anth-volk/fix/hotfix-decile-charts
Browse files Browse the repository at this point in the history
Hot-fix remove of invalid deciles in charts
  • Loading branch information
anth-volk authored Oct 25, 2024
2 parents 5b4e95e + 9303a1d commit e2be8bb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
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

0 comments on commit e2be8bb

Please sign in to comment.