You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is countries where the cost per KwH can be above 99 in the local currency.
Steps To Reproduce
Set a cost per kwh at 101 in a geofence
Saved value is 99
Relevant log output
2024-11-30 15:44:41.153 [error] GenServer #PID<0.40937.0> terminating** (Postgrex.Error) ERROR 22003 (numeric_value_out_of_range) numeric field overflow
A field with precision 6, scale 4 must round to an absolute value less than 10^2.
(ecto_sql 3.12.1) lib/ecto/adapters/sql.ex:1096: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto 3.12.4) lib/ecto/repo/schema.ex:834: Ecto.Repo.Schema.apply/4
(ecto 3.12.4) lib/ecto/repo/schema.ex:505: anonymous fn/15 in Ecto.Repo.Schema.do_update/4
(teslamate 1.31.1) lib/teslamate/locations.ex:196: anonymous fn/3 in TeslaMate.Locations.update_geofence/2
(ecto_sql 3.12.1) lib/ecto/adapters/sql.ex:1400: anonymous fn/3 in Ecto.Adapters.SQL.checkout_or_transaction/4
(db_connection 2.7.0) lib/db_connection.ex:1756: DBConnection.run_transaction/4
(teslamate 1.31.1) lib/teslamate_web/live/geofence_live/form.ex:158: TeslaMateWeb.GeoFenceLive.Form.save/1
(teslamate 1.31.1) lib/teslamate_web/live/geofence_live/form.ex:62: TeslaMateWeb.GeoFenceLive.Form.handle_event/3
Last message: %Phoenix.Socket.Message{topic: "lv:phx-GAzGMUiOkUHEzS8B", event: "event", payload: %{"event" =>"save", "type" =>"form", "value" =>"leaflet-base-layers_29=on&geo_fence%5Blatitude%5D=47.508335&geo_fence%5Blongitude%5D=19.064648&geo_fence%5Bradius%5D=20&geo_fence%5Bname%5D=Lehel&geo_fence%5Bbilling_type%5D=per_kwh&geo_fence%5Bcost_per_unit%5D=199.0000&geo_fence%5Bsession_fee%5D=0.00"}, ref: "13", join_ref: "11"}
Screenshots
Additional data
I was thinking about modifying the field to be able to go up to 9999.9999 modify(:cost_per_kwh, :decimal, precision: 8, scale: 4)
But there would still be some countries that could not enter their costs:
Here are the top 10 of those that represent the most for 0.1$:
Iranian Rial (IRR): About 4,250 IRR for 0.1 USD.
Vietnamese Dong (VND): About 2,430 VND for 0.1 USD.
Indonesian Rupiah (IDR): About 1,570 IDR for 0.1 USD.
Laotian Kip (LAK): About 2,060 LAK for 0.1 USD.
Sierra Leonean Leone (SLL): About 2,100 SLL for 0.1 USD.
Uzbekistani Som (UZS): About 1,220 UZS for 0.1 USD.
Guinean Franc (GNF): About 870 GNF for 0.1 USD.
Paraguayan Guarani (PYG): About 730 PYG for 0.1 USD.
Cambodian Riel (KHR): About 410 KHR for 0.1 USD.
Tanzanian Shilling (TZS): About 250 TZS for 0.1 USD.
To make it work worldwide, you would need to go up to 99999.9999 modify(:cost_per_kwh, :decimal, precision: 9, scale: 4)
Type of installation
Docker
Version
1.31.1
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
What happened?
Can't set a cost per KwH above 99
Expected Behavior
There is countries where the cost per KwH can be above 99 in the local currency.
Steps To Reproduce
Set a cost per kwh at 101 in a geofence
Saved value is 99
Relevant log output
Screenshots
Additional data
I was thinking about modifying the field to be able to go up to 9999.9999
modify(:cost_per_kwh, :decimal, precision: 8, scale: 4)
But there would still be some countries that could not enter their costs:
Here are the top 10 of those that represent the most for 0.1$:
Iranian Rial (IRR): About 4,250 IRR for 0.1 USD.
Vietnamese Dong (VND): About 2,430 VND for 0.1 USD.
Indonesian Rupiah (IDR): About 1,570 IDR for 0.1 USD.
Laotian Kip (LAK): About 2,060 LAK for 0.1 USD.
Sierra Leonean Leone (SLL): About 2,100 SLL for 0.1 USD.
Uzbekistani Som (UZS): About 1,220 UZS for 0.1 USD.
Guinean Franc (GNF): About 870 GNF for 0.1 USD.
Paraguayan Guarani (PYG): About 730 PYG for 0.1 USD.
Cambodian Riel (KHR): About 410 KHR for 0.1 USD.
Tanzanian Shilling (TZS): About 250 TZS for 0.1 USD.
To make it work worldwide, you would need to go up to 99999.9999
modify(:cost_per_kwh, :decimal, precision: 9, scale: 4)
Type of installation
Docker
Version
1.31.1
The text was updated successfully, but these errors were encountered: