chrono: add script to check for invalid event recurrences
This commit is contained in:
parent
eb8863136e
commit
fb3e1c530b
|
@ -0,0 +1,14 @@
|
|||
from django.db import connection
|
||||
|
||||
from chrono.agendas.models import Event
|
||||
from django.db.models import Count
|
||||
|
||||
duplicated_events = (
|
||||
Event.objects.values("primary_event", "start_datetime")
|
||||
.annotate(count=Count("id"))
|
||||
.values("pk")
|
||||
.order_by()
|
||||
.filter(count__gt=1)
|
||||
)
|
||||
if duplicated_events.count():
|
||||
print(connection.schema_name, duplicated_events)
|
Loading…
Reference in New Issue