quintel / etflex

An interface for the Energy Transition Model for beginners and those in education
https://light.energytransitionmodel.com
1 stars 2 forks source link

How can we multiply a gquery result value? #135

Closed dennisquintel closed 12 years ago

dennisquintel commented 12 years ago

We need to put 4% here in stead of 0.04...

dennisquintel commented 12 years ago

The answer is adding the following gquery: percentage_renewables_in_renewability, which already multiplies it by a factor 100.

dennisquintel commented 12 years ago

Hmmm... could we use the already existing mutateValue method in renewables.coffee#20-23 ?

  # Convert fractions to a percentage.
  mutateValue:  (value) -> value * 100
  displayValue: DISPLAY_PERCENTAGE
antw commented 12 years ago

Closed by e48e65945.

Value formatting has been removed from the DashboardProp classes. Each Query now has a mutated and formatted method which will return the appropriate values. If you want to change the way a query is displayed in the UI, you can find the relevant line in query_transforms.coffee. Each query key is represented in the TRANSFORMS hash, and the format function controls how the query value appears throughout the UI.

The query_transforms file is a bit ugly; since ET-Engine already knows the unit of each query (%, factor, PJ, etc) it would be ideal to re-use that. But we can worry about that in a week or two... this should suffice for now.