Speed up sql
Some checks failed
/ test (push) Has been cancelled

This commit is contained in:
eleon 2024-11-21 21:14:38 +01:00 committed by jedi
parent 72ff5aea12
commit 385831d735
4 changed files with 18 additions and 12 deletions

View file

@ -24,7 +24,7 @@ class BasicItemSerializer(serializers.ModelSerializer):
def get_file(self, instance):
if len(instance.files.all()) > 0:
return instance.files.all().order_by('-created_at')[0].hash
return sorted(instance.files.all(), key=lambda x: x.created_at, reverse=True)[0].hash
return None
def get_returned(self, instance):