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

fix: compare ID instead of whole object to avoid badly cast fields #21

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions filesmanager/filesmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,10 @@ def sync_with_course_assets(self):
- Compare the files from the course assets with the files from the directories list.
- Remove the files that are in the directory list but not in the course assets.
"""
course_assets_files = self.get_all_serialized_assets()
course_assets_ids = [asset["id"] for asset in self.get_all_serialized_assets()]
directories_files = self.get_all_files(self.directories["children"])
for file in directories_files:
if file["metadata"] not in course_assets_files:
if file["metadata"]["id"] not in course_assets_ids:
self.delete_file_from_directory(file)

def delete_file_from_directory(self, file):
Expand Down