climate-cooperative/home-energy-assessment-database

Move Calculation off of Calculator

Opened this issue · 2 comments

Description

We want to move complex logic off of the FE's and into the api, for better separation of concern and access to this logic.

This means we need to replicate the existing logic around the result calculation into the api. Create a service that performs this calculation (homeEnergy.service.js).

Technical Notes

Move this logic, specifically handleCalculation into the back end.

  • Create Unit tests! homeEnergy.service.test.js
  • A stand-alone piece of logic/service
  • DO NOT WIRE INTO ANY ENDPOINT (see below)

Risks

Related Issues Or Discussions

#30 Will be the continuation of this work to wire it together.

Assume that any required material for the calculations will be a) passed in from user request b) lives in the database