Skip to content

Commit

Permalink
demo file listing improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
marifergun committed Nov 23, 2023
1 parent 51b2a6d commit f8d205c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cosapweb/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def list(self, request, project_id=None):
return Response(files)

if sample_type:
files = File.objects.filter(Q(user=request.user, sample_type=sample_type) | Q(is_demo=True))
files = File.objects.filter((Q(user=request.user) | Q(is_demo=True)), Q(sample_type=sample_type))
files = {
files[i].uuid: f"{i+1} - {files[i].name}" for i in range(len(files))
}
Expand All @@ -392,7 +392,7 @@ def list(self, request, project_id=None):
if file_type:
files = {
file.uuid: f"{file.project.name} - {file.name}"
for file in File.objects.filter(Q(user=request.user, file_type=file_type) | Q(is_demo=True))
for file in File.objects.filter((Q(user=request.user) | Q(is_demo=True)), Q(file_type=file_type))
}
return Response(files)

Expand Down

0 comments on commit f8d205c

Please sign in to comment.