Remove false precision from area estimates

We give estimates of the area for those who can’t see the map. These
estimates were needlessly precise, gave a false sense of accuracy and
were causing intermittent test failures between different environments.

This commit rounds them in the same way that we round the count of
phones.
This commit is contained in:
Chris Hill-Scott
2021-06-24 16:54:08 +01:00
parent e4ca78634d
commit 2accf8434a
3 changed files with 20 additions and 18 deletions

View File

@@ -72,6 +72,7 @@ from app.formatters import (
nl2br,
recipient_count,
recipient_count_label,
round_to_significant_figures,
valid_phone_number,
)
from app.models.organisation import Organisation
@@ -564,6 +565,7 @@ def add_template_filters(application):
iteration_count,
recipient_count,
recipient_count_label,
round_to_significant_figures,
message_count_label,
message_count,
message_count_noun,

View File

@@ -3,7 +3,7 @@
<ul>
<li class="area-list-key area-list-key--certain">
<span class="visually-hidden">
An area of {{ "{:,.1f}".format(broadcast_message.simple_polygons.estimated_area) }} square miles
An area of {{ (broadcast_message.simple_polygons.estimated_area)|round_to_significant_figures(1)|format_thousands }} square miles
</span>
Will get
<span class="visually-hidden">the</span>
@@ -11,7 +11,7 @@
</li>
<li class="area-list-key area-list-key--likely">
<span class="visually-hidden">
An extra area of {{ "{:,.1f}".format(broadcast_message.simple_polygons_with_bleed.estimated_area - broadcast_message.simple_polygons.estimated_area) }} square miles is
An extra area of {{ (broadcast_message.simple_polygons_with_bleed.estimated_area - broadcast_message.simple_polygons.estimated_area)|round_to_significant_figures(1)|format_thousands }} square miles is
</span>
Likely to get
<span class="visually-hidden">