Historical weather popups read Fahrenheit and mph for a metric visitor #57
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Markers whose data comes from a historical batch build their popup with hard-coded imperial units, while a live packet for the same station goes through the locale conversion. A visitor on the de, es or fr locale reads
Temperature: 72°F, Wind: 10 mph, Rain 0.0 inon a historical marker, then sees the same marker switch to 22.2°C, 16.1 km/h and 0.0 mm as soon as one packet arrives.Evidence
At
2f150f66:lib/aprsme_web/live/map_live/data_builder.ex:208sets"temp_unit" => "°F",:212"wind_unit" => "mph"and:219"rain_1h_unit" => "in"inbuild_lazy_popup_data/2, which never receives a locale.lib/aprsme_web/live/map_live/data_builder.ex:239and:243hard-code the same units inbuild_simple_popup_data/1, the popup path used for the current marker of a historical batch.lib/aprsme_web/live/map_live/data_builder.ex:394shows the conversion lives inbuild_weather_popup_html/3, reached only for live packets.lib/aprsme_web/weather_units.ex:82defines the metric converter the historical path never calls.Expected
Every weather popup respects the visitor's locale, so a metric visitor never sees Fahrenheit, mph or inches on the map.
How to verify
In IEx, build a packet data list through
AprsmeWeb.MapLive.DataBuilder.build_packet_data_list/1with a weather packet and inspecttemp_unit: it is°Fwith no locale consulted. A test asserting°Cfor localedefails today.Acceptance criteria
Effort: S
Lens: product