Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Delete fucntion to get latest page and image number #76
Browse files Browse the repository at this point in the history
  • Loading branch information
carrosa committed Jan 29, 2019
1 parent a92dd0f commit eab3957
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions src/django_backend/fg/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,48 +169,6 @@ def get_queryset(self):
return models.Photo.objects.filter(security_level__name="ALLE")


@api_view(['GET'])
def get_latest_image_number_and_page_number(request, album_id='', analog=False):
try:
if album_id:
latest_album = models.Photo.objects.filter(
album=album_id.strip()).latest('date_taken').album
elif analog: # TODO or FIX: currently no need for this
latest_album = models.Photo.objects.exclude(
album__name__startswith='DIG').latest('date_taken').album
else:
latest_album = models.Photo.objects.filter(
album__name__startswith='DIG').latest('date_taken').album
latest_page = models.Photo.objects.filter(
album__name=latest_album.name).aggregate(Max('page'))['page__max']
latest_image_number = (models.Photo.objects.filter(
album__name=latest_album.name, page=latest_page).aggregate(Max('image_number'))['image_number__max'])
if latest_image_number >= 99:
if latest_page < 99:
latest_image_number = 1
latest_page = latest_page + 1
else:
return Response({
'album': latest_album.id,
'latest_page': 'fullt',
'latest_image_number': 'fullt'
})
else:
latest_image_number = latest_image_number + 1
return Response({
'album': latest_album.id,
'latest_page': latest_page,
'latest_image_number': latest_image_number
})
except ObjectDoesNotExist as e:
print(e)
return Response({
'album': 0,
'latest:page': 1,
'latest_image_number': 1
})


class LatestSplashPhotoView(RetrieveAPIView):
"""
Retrieves the latest photo with splash set to True
Expand Down

0 comments on commit eab3957

Please sign in to comment.