AJamesPhillips / DataCurator

DataCurator enables you to map and understand complex systems before helping you plan, communicate and navigate successful interventions in them.
https://DataCurator.org
8 stars 1 forks source link

Get percentage values being parsed and shown correctly #241

Closed AJamesPhillips closed 3 months ago

AJamesPhillips commented 11 months ago

Describe the bug

A calculation row in this component is referencing another component with a value of 90% but it's then being used as 90 not 0.9 so it becomes 9000% not 90%

image

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://datacurator.org/app/#wcomponents/8a9a4fab-d12e-42db-b067-3c684f4bd362/&storage_location=1&subview_id=c27cea1e-17f8-4800-9b0f-3b3377244cd4&view=knowledge&x=521&y=-1532&zoom=48&sdate=2023-12-11&stime=16:06:24&cdate=2023-12-11&ctime=16:06:24

Expected behavior

Value from source component should be provided as 0.9 (i.e. 90% == 90 * 0.01 == 0.9)

Additional context

The source component's value is saying 90, 95 instead of 90%, 95% and this is whilst the values entered into the two VAPs are 90% and 95%.

We need to allow for the value e.g. 90% == 90*0.01 == 0.9 to be separate from the presentation e.g. 0.9 displays as 0.9 when normally presented or 90% when presented as a percentage.

When a user enters a value as 0.9 or 90% then it should equate to the same value, but in both cases the user can choose to present this value as 0.9 or 90% and have this presentation feed through to the component's self reported value as a string. And have this value feed through to other components that are referencing it... i.e. 90% should have a value of 0.9 not 90 to avoid it then becoming 9000% when formatted as a percentage.

Additional features


screenshot of calculation row error showing warning triangle above calculation row with invalid number
image

With feature F1 (above) we have alerted the editor when they've entered an invalid number, but when a consumer comes along it is not obvious which components are "broken" and what NaN means. Instead perhaps we replace NaN with the warning triangle and include the invalid value (not NaN). Optionally we could also cross it out &/ colour it red. We could also set the component node background to red to highlight that is has a problem.

AJamesPhillips commented 10 months ago

Feature F1 is completed with a08600cc

Whilst in presentation mode:

image

Whilst in editing mode:

image
AJamesPhillips commented 3 months ago

Closing for now as partial solution in place.

Pasted_Image_23_07_2024__15_48 Exploring_calculations___CCI_Data_Curator