latest changes
This commit is contained in:
Binary file not shown.
@@ -53,6 +53,7 @@
|
||||
<small>{% trans "Optional. Without an accepted window, BoomCast reports the count without an intensity rating." %}</small>
|
||||
</div>
|
||||
{% include "fireworks_detect/includes/manual_direction_panel.html" %}
|
||||
<label class="manual-report__check" for="manual-visually-confirmed"><input id="manual-visually-confirmed" name="visually_confirmed" type="checkbox"> {% trans "Visually confirmed" %}</label>
|
||||
</div>
|
||||
<section class="manual-report__supporting" data-state="off" aria-labelledby="manual-listening-title">
|
||||
<div class="manual-report__supporting-header">
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<p>{% if pending.is_burst %}{% trans "Burst Event" %}{% else %}{% trans "Ordinary report" %}{% endif %} · {% trans "Submitted" %} {{ pending.created_at|date:"j M Y, H:i" }}</p>
|
||||
{% if pending.is_burst %}<p>{% trans "Duration" %}: {% if pending.observation_duration_minutes %}{{ pending.observation_duration_minutes }} {% trans "minutes (estimated)" %}{% else %}{% trans "Unknown" %}{% endif %}</p>
|
||||
<p>{% trans "Intensity" %}: {% if pending.burst_intensity %}{{ pending.burst_intensity_display }} ({{ pending.bangs_per_15_minutes|floatformat:1 }} {% trans "bangs per 15 minutes" %}){% else %}{% trans "Not rated" %}{% endif %}</p>{% endif %}
|
||||
<p>{% trans "Visually confirmed" %}: {% if pending.visually_confirmed %}{% trans "Yes" %}{% else %}{% trans "No" %}{% endif %}</p>
|
||||
{% if request.user.is_authenticated %}<p><a href="{% url 'fireworks_detect:field_notes' %}?pending={{ pending.pk }}">{% trans "Add or review field notes for this report" %}</a></p>{% endif %}
|
||||
{% if editable %}<form class="manual-submission__edit" method="post" action="{% url 'fireworks_detect:update_manual_pending' pending.pk %}" hx-post="{% url 'fireworks_detect:update_manual_pending' pending.pk %}" hx-target="#manual-submission" hx-swap="outerHTML">
|
||||
{% csrf_token %}
|
||||
|
||||
@@ -55,6 +55,24 @@ class ManualPendingEventTests(TestCase):
|
||||
def setUp(self):
|
||||
self.client.cookies["django_language"] = "en"
|
||||
|
||||
def test_manual_visual_confirmation_is_optional_and_survives_review(self):
|
||||
url = reverse("fireworks_detect:submit_manual_pending")
|
||||
for posted, expected in (({}, False), ({"visually_confirmed": "on"}, True)):
|
||||
with self.subTest(confirmed=expected):
|
||||
response = self.client.post(url, {"occurrences": "1", **posted})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
pending = PendingEvent.objects.latest("pk")
|
||||
self.assertEqual(pending.visually_confirmed, expected)
|
||||
self.assertContains(response, f"Visually confirmed: {'Yes' if expected else 'No'}")
|
||||
update_url = reverse("fireworks_detect:update_manual_pending", args=[pending.pk])
|
||||
self.client.post(update_url, {"occurrences": "2"})
|
||||
pending.refresh_from_db()
|
||||
self.assertEqual(pending.visually_confirmed, expected)
|
||||
event = pending.approve()
|
||||
self.assertEqual(event.visually_confirmed, expected)
|
||||
self.assertContains(self.client.get(reverse("fireworks_detect:event_detail", args=[event.pk])),
|
||||
f"Visually confirmed</strong><span>{'Yes' if expected else 'No'}")
|
||||
|
||||
def test_manual_report_creates_a_timestamped_pending_event(self):
|
||||
response = self.client.post(reverse("fireworks_detect:submit_manual_pending"), {
|
||||
"occurrences": "4",
|
||||
|
||||
@@ -577,6 +577,7 @@ def submit_manual_pending_event(request):
|
||||
latitude=latitude,
|
||||
longitude=longitude,
|
||||
h3_cell=h3_cell or "",
|
||||
visually_confirmed=request.POST.get("visually_confirmed") == "on",
|
||||
direction_degrees=direction_degrees,
|
||||
direction_accuracy_degrees=direction_accuracy_degrees,
|
||||
direction_source="device_compass" if direction_degrees is not None else "",
|
||||
|
||||
Reference in New Issue
Block a user