Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added: Validate file existence validation in Experiment & Playlist forms #1042

Merged
merged 6 commits into from
Jun 3, 2024

Conversation

drikusroor
Copy link
Contributor

@drikusroor drikusroor commented May 29, 2024

This pull request fixes the file existence validation in the Playlist model and admin form.

The clean_csv method in the Playlist model now performs file existence validation for section files. It checks if the referenced files exist using the file_exists_validator function. If any file is not found, a ValidationError is raised and added to the csv field errors.

Additionally, it fixes an existing problem in the experiment rules validation method.

Copy link
Collaborator

@BeritJanssen BeritJanssen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! The issues I pointed out in experiment.forms will get fixed with merging, just pointing this out in case you want to drop commit 2d02f53 here to clean the history.

The commit adds a new validation method, `file_exists_validator`, to check if the section files referenced in the playlist exist. This validation is performed in the `clean` method of the Playlist model. If any section file is not found, a `ValidationError` is raised and added to the `csv` field errors.
The commit refactors the `clean_csv` method in the Playlist model to perform file existence validation for section files. It iterates over the sections associated with the playlist and checks if the referenced files exist using the `file_exists_validator` function. If any file is not found, a `ValidationError` is raised and added to the `csv` field errors.
@drikusroor drikusroor force-pushed the enhance/playlist-validation-file-exist branch from 64859f7 to 154ead1 Compare June 3, 2024 08:57
@drikusroor drikusroor merged commit 161b248 into develop Jun 3, 2024
10 checks passed
@drikusroor drikusroor deleted the enhance/playlist-validation-file-exist branch June 3, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants