You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bulk download results/submissions: dead code in submissions.py #2538
Introduced useless lines of code in src/apps/api/views/submissions.py, in function download_many:
forsubinsubmissions:
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.urlurl=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})
returnResponse(files)
forsubinsubmissions:
ifsub.statusnotin [Submission.FINISHED]: # Submission.FAILED, Submission.CANCELLEDcontinuefile_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})
returnResponse(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.
Activity