Skip to content

Commit

Permalink
fix: temporarily handle uid assignment on archived emissions
Browse files Browse the repository at this point in the history
  • Loading branch information
ohrstrom committed Dec 2, 2022
1 parent c16abcc commit 68d46f3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions core/stats/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from datetime import timedelta
from catalog.models import Playlist, Media
from catalog.models import Airplay as CatalogAirplay
from django.db import transaction
from django.db import transaction, IntegrityError
from broadcast.models import Emission as BroadcastEmission
from .settings import ARCHIVE_AFTER_DAYS

Expand Down Expand Up @@ -145,9 +145,13 @@ def archive_airplays(database="default"):
for e in Emission.objects.filter(
uid__isnull=True,
):
Emission.objects.filter(id=e.id,).update(
uid=e.get_uid(),
)
try:
Emission.objects.filter(id=e.id).update(
uid=e.get_uid(),
)
except IntegrityError:
# TODO: check implications.!.
continue

# for airplay in airplay_qs:
# try:
Expand Down

0 comments on commit 68d46f3

Please sign in to comment.