Fix exception reporting

pull/1/head
Luca 3 years ago
parent 73d214615e
commit df9493f6cd

@ -49,8 +49,10 @@ class CancelMin(types.DurationPreference):
name = "min_cancel_time" name = "min_cancel_time"
default = datetime.timedelta(hours=6) default = datetime.timedelta(hours=6)
@global_preferences_registry.register @global_preferences_registry.register
class SMSRate(types.IntegerPreference): class SMSRate(types.IntegerPreference):
section = helper section = helper
name = "sms_rate" name = "sms_rate"
default = 2 default = 2
help_text = "Number of SMS sent per minute"

@ -29,7 +29,9 @@ def send_messages():
print("sms disabled, not sending") print("sms disabled, not sending")
return return
msgs = Message.objects.select_for_update().filter(sent_at__isnull=True)[:global_preferences['helper__sms_rate']*2] msgs = Message.objects.select_for_update().filter(sent_at__isnull=True)[
: global_preferences["helper__sms_rate"] * 2
]
with transaction.atomic(): with transaction.atomic():
for msg in msgs: for msg in msgs:
if msg.sent_at: if msg.sent_at:
@ -38,7 +40,7 @@ def send_messages():
send(msg) send(msg)
msg.sent_at = timezone.now() msg.sent_at = timezone.now()
msg.save() msg.save()
except e: except Exception as e:
sentry_sdk.capture_exception(e) sentry_sdk.capture_exception(e)
@ -80,5 +82,5 @@ def send_reminders():
continue continue
try: try:
reg.send_reminder() reg.send_reminder()
except: except Exception as e:
pass sentry_sdk.capture_exception(e)

@ -14,7 +14,7 @@
<div class="notification">Diese Schicht ist bereits besetzt.</div> <div class="notification">Diese Schicht ist bereits besetzt.</div>
{% endif %} {% endif %}
<div class="content"> <div class="content">
<strong>Ort:</strong> <a href="{% url 'pages:view' 'map' %}#{{shift.room.name|slugify}}">{{ shift.room.name }} 📍</a><br> <strong>Ort:</strong> <a href="{% url 'pages:view' 'map' %}#{{ shift.room.name|slugify }}">{{ shift.room.name }} 📍</a><br>
<strong>Beginn:</strong> {{ shift.start_at }}<br> <strong>Beginn:</strong> {{ shift.start_at }}<br>
<strong>Dauer:</strong> {{ shift.duration }}<br> <strong>Dauer:</strong> {{ shift.duration }}<br>
<strong>Treffpunkt:</strong> {{ shift.room.meeting_location }}<br> <strong>Treffpunkt:</strong> {{ shift.room.meeting_location }}<br>

@ -1,3 +1 @@
<div class="content"> <h5 class="subtitle">Hier erscheint bald die Karte mit allen Schichtstandorten</h5>
<h5 class="mb-2">Hier erscheint bald die Karte mit allen Schichtstandorten</h5>
</div>

Loading…
Cancel
Save