pledge4future / WePledge

WebApp to calculate work related CO2e emissions from heating and electricity consumption as well as business trips and commuting.
https://pledge4future.org
GNU General Public License v3.0
6 stars 2 forks source link

Limit Combinations of energy source and unit in heating emission entry #233

Open codingfabi opened 1 year ago

codingfabi commented 1 year ago

When trying to add a heating emission entry, the backend fails with the following error message:

No conversion data is available for this fuel type. Provide consumption in a different unit.

This is the request I'm sending:

{
    "timestamp": "2021-04-01",
    "consumption": 4000,
    "fuelType": "Electricity",
    "building": "205",
    "groupShare": 2,
    "unit": "kwH"
}

I tried a few different fuel types, the result is the same for all. I assume that this is a co2-calculator error @redfrexx?

codingfabi commented 1 year ago

I realized that the backend also logs the following command to the console output of the container:

0         oil    l
1  liquid_gas   kg
2        coal   kg
3      pellet   kg
4   woodchips   kg
5         gas  m^3

So as far as I can tell, not all combinations of source and unit are working. @redfrexx is there a list of what is working with what so we can adjust the forms.

codingfabi commented 1 year ago

It would be ideal if the backend returned a data structure like this:

[
    {
    "type" : "gas",
    "units": "m^3"   
    },
    {
    "type" : "oil",
    "units": ["m^3", "l"]   
    }
]