PolicyEngine / policyengine-app

PolicyEngine's free web app for computing the impact of public policy.
GNU Affero General Public License v3.0
41 stars 109 forks source link

Repair wrappedJsonStringify, modify reformDefinitionCode #2178

Closed anth-volk closed 3 weeks ago

anth-volk commented 3 weeks ago

Description

Fixes #2106.

Changes

Previously, we improperly handled advanced features of JSON.stringify() within wrappedJsonStringify, causing the Reproduce in Python page to treat Infinity as null. Further, we had no means of importing numpy in the Reproduce in Python output. This PR changes wrappedJsonStringify to properly handle more than two arguments to JSON.stringify() and modifies reformDefinitionCode to check if any baseline or reform values are infinite, at which point it adds a line to import numpy.

Screenshots

AwesomeScreenshot-10_31_2024,9_15_43PM.webm

Tests

The code output was tested within a local run of -us and appears to work correctly.

anth-volk commented 3 weeks ago

@nikhilwoodruff This is one of the two other issues I mentioned in the standup