usnistgov / E3

API that provides standards based economic calculations.
Other
6 stars 3 forks source link

Fix: Update validation condition, del redundant check #37

Closed tashakim closed 2 years ago

tashakim commented 2 years ago

Description

This PR makes an update following discussion in issue #35.

Outdated logic in Analysis class checked that all 3 variables from: inflation rate, real discount rate, and nominal discount rate, were provided upon creation of an Analysis object. However, due to an additional condition that was added later regarding the output real boolean provided from user, this code is outdated.

The current PR removes redundant assertion error throwing in the Analysis class, which already exists in the AnalysisSerializer class, and replaces it with an assertion that all necessary variables were either provided or computed from the serializer.

Motivation and Context

The current code correctly calculates Analysis for every case except for the following: Currently the code requires 2 values even when the real discount rate is provided. But if outputRealBool = true, then (1) we need ONLY the real discount rate OR (2) both the nominal discount rate and inflation rates.

Closes #35