@ObadaS @nicomy
The following PR:
Introduced useless lines of code in src/apps/api/views/submissions.py, in function download_many:
for sub in submissions:
file_path = sub.data.data_file.name.split('/')[-1]
short_name = f"{sub.id}_{sub.owner}_PhaseId{sub.phase.id}_{sub.data.created_when.strftime('%Y-%m-%d:%M-%S')}_{file_path}"
# url = sub.data.data_file.url
url = SubmissionDetailSerializer(sub.data, context=self.get_serializer_context()).data['data_file']
# url = SubmissionFilesSerializer(sub, context=self.get_serializer_context()).data['data_file']
files.append({"name": short_name, "url": url})
return Response(files)
for sub in submissions:
if sub.status not in [Submission.FINISHED]: # Submission.FAILED, Submission.CANCELLED
continue
file_path = sub.data.data_file.name.split('/')[-1]
complete_name = f"res_{sub.id}_{sub.owner}_PhaseId{sub.phase.id}_{sub.data.created_when.strftime('%Y-%m-%d:%M-%S')}_{file_path}"
result_url = SubmissionDetailSerializer(sub.data, context=self.get_serializer_context()).get_scoring_result(sub)
# detailed results is already in the results zip file but For very large detailed results it could be helpfull to remove it
# detailed_result_url = serializer.get_scoring_result(sub)
files.append({"name": complete_name, "url": result_url})
return Response(files)
Everything that comes after the first return Response(files) will never be executed. It feels like another version of the same code, or under-progress version or something.
We can simply remove these lines, but I feel like there are interesting things that we can merge with the part above, like comments, the use of the prefix res_ in filename to avoid conflict between results and submissions, etc.
@ObadaS @nicomy
The following PR:
Introduced useless lines of code in
src/apps/api/views/submissions.py, in functiondownload_many:Everything that comes after the first
return Response(files)will never be executed. It feels like another version of the same code, or under-progress version or something.We can simply remove these lines, but I feel like there are interesting things that we can merge with the part above, like comments, the use of the prefix
res_in filename to avoid conflict between results and submissions, etc.