latest changes before manual submissions redesign
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,3 +3,6 @@ from django.apps import AppConfig
|
||||
|
||||
class FireworksDetectConfig(AppConfig):
|
||||
name = 'fireworks_detect'
|
||||
|
||||
def ready(self):
|
||||
from . import signals # noqa: F401
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
from django.db.models import F
|
||||
from django.db.models.signals import post_save
|
||||
from django.dispatch import receiver
|
||||
from django.utils import timezone
|
||||
|
||||
from members.models import PendingNotificationBatch, UserSettings
|
||||
|
||||
from .models import PendingEvent
|
||||
|
||||
|
||||
@receiver(post_save, sender=PendingEvent)
|
||||
def count_new_pending_event(sender, instance, created, **kwargs):
|
||||
if not created:
|
||||
return
|
||||
minute = timezone.now().replace(second=0, microsecond=0)
|
||||
field = "manual_count" if instance.source_type == PendingEvent.SourceType.MANUAL else "sensor_count"
|
||||
for user_id in UserSettings.objects.filter(ntfy_enabled=True).exclude(ntfy_url="").values_list("user_id", flat=True):
|
||||
batch, _ = PendingNotificationBatch.objects.get_or_create(user_id=user_id, minute=minute)
|
||||
PendingNotificationBatch.objects.filter(pk=batch.pk).update(**{field: F(field) + 1})
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
<section class="upload-card" aria-label="{% trans "Upload audio for classification" %}">
|
||||
{% include "fireworks_detect/includes/audio_upload_form.html" %}
|
||||
</section>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -35,4 +35,17 @@
|
||||
</div>
|
||||
</form>
|
||||
<div id="manual-submission" class="manual-report__submission" aria-live="polite"></div>
|
||||
<div id="manual-compass" class="manual-compass" role="img" aria-label="{% trans 'Compass direction' %}" hidden>
|
||||
<div class="manual-compass__dial" aria-hidden="true">
|
||||
<div id="manual-compass-rose" class="manual-compass__rose">
|
||||
<span class="manual-compass__north">N</span>
|
||||
<span class="manual-compass__east">E</span>
|
||||
<span class="manual-compass__south">S</span>
|
||||
<span class="manual-compass__west">W</span>
|
||||
</div>
|
||||
<span class="manual-compass__pointer"></span>
|
||||
<span class="manual-compass__center"></span>
|
||||
</div>
|
||||
<span id="manual-compass-heading" class="manual-compass__heading"></span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -7,6 +7,14 @@
|
||||
<a href="{% url "fireworks_detect:fireworks" %}"{% if active_page == "analyse" %} aria-current="page"{% endif %}>{% trans "Analyse" %}</a>
|
||||
<a href="{% url "fireworks_detect:map" %}"{% if active_page == "map" %} aria-current="page"{% endif %}>{% trans "Map" %}</a>
|
||||
<a href="{% url "fireworks_detect:events" %}"{% if active_page == "events" %} aria-current="page"{% endif %}>{% trans "Events" %}</a>
|
||||
{% if request.user.is_authenticated %}
|
||||
<form action="{% url 'logout' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<button type="submit">{% trans "Sign out" %}</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<a href="{% url 'login' %}">{% trans "Sign in" %}</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% if not request.user.is_authenticated %}
|
||||
<form class="public-language" action="{% url 'set_anonymous_language' %}" method="post" style="display:flex;align-items:center;gap:.3rem;color:var(--muted,#aab9d8);font-size:.78rem">
|
||||
|
||||
@@ -160,6 +160,8 @@ class ManualPendingEventTests(TestCase):
|
||||
self.assertContains(response, "I heard fireworks — send to Pending")
|
||||
self.assertContains(response, "Capture direction")
|
||||
self.assertContains(response, 'manual-direction-panel" hidden')
|
||||
self.assertContains(response, 'id="manual-compass"')
|
||||
self.assertContains(response, 'aria-label="Compass direction" hidden')
|
||||
self.assertContains(response, "htmx.min.js")
|
||||
self.assertContains(response, "/static/vite/")
|
||||
self.assertContains(response, 'type="module"')
|
||||
|
||||
Reference in New Issue
Block a user