A brief description of the purpose of the changes contained in this PR.
This piece of code avoids crash when trying to access the size of a file that does not exist anymore in the storage. If an error is caught it then clears the file_size and data_file attribute in the DB.
Issues this PR resolves
Should solve Problem 1 of issue #1451
Simple test
A simple test would be to:
create a private competition
upload a submission
change in the database (manually or by using the django admin interface) the file_size attribute to -1 of one of the submission's dataset (table datasets_data)
remove in the storage (by using the minio interface) the corresponding file (its path is the value of the column data_file of the row in which you changed the file_size attribute)
Open up the shell_plus console inside the container of django
Call thesave() method of the dataset object you modified. It will do some checks on the existence of the file in the storage and do the necessary updates. It should be something in those lines:
Original PR: #1454
A brief description of the purpose of the changes contained in this PR.
This piece of code avoids crash when trying to access the size of a file that does not exist anymore in the storage. If an error is caught it then clears the file_size and data_file attribute in the DB.
Issues this PR resolves
Should solve Problem 1 of issue #1451
Simple test
A simple test would be to:
file_size
attribute to -1 of one of the submission's dataset (table datasets_data)data_file
of the row in which you changed thefile_size
attribute)save()
method of the dataset object you modified. It will do some checks on the existence of the file in the storage and do the necessary updates. It should be something in those lines:Use case test
Checklist