usnistgov / E3

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

Fix: missing value past validation (Analysis) #25

Closed tashakim closed 3 years ago

tashakim commented 3 years ago

Description

This PR adds additional validation to the validate method in the AnalysisSerializer, to give immediate feedback to the user as to why the calculation failed. Namely, only one of (inflation rate, real or nominal discount rates) were provided. This will throw a ValidationError with a message.

Motivation and Context

At least two in (inflation rate, real discount rate, nominal discount rate) must be provided to calculate Analysis. However, in some cases, providing only one of these variables gets past validation, and throws an AssertionError in Analysis.py. This should be caught by the serializer validator so that feedback is given to the user as to why the calculation failed.

Closes #21