-
Notifications
You must be signed in to change notification settings - Fork 29
ProFormA Import: fix file duplication #3059
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
base: main
Are you sure you want to change the base?
ProFormA Import: fix file duplication #3059
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3059 +/- ##
==========================================
+ Coverage 70.24% 70.26% +0.01%
==========================================
Files 215 215
Lines 6850 6853 +3
==========================================
+ Hits 4812 4815 +3
Misses 2038 2038 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ca97dd2
to
626892a
Compare
…me, path, role and file_type
626892a
to
d1c54e4
Compare
@@ -60,6 +60,8 @@ class File < ApplicationRecord | |||
validates :weight, absence: true, unless: :teacher_defined_assessment? | |||
validates :file, presence: true if :context.is_a?(Submission) | |||
validates :context_type, inclusion: {in: ALLOWED_CONTEXT_TYPES} | |||
validates :path, uniqueness: {scope: %I[name file_type context_id context_type role]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have records that have this issue right now? I am worried that this migration will suddenly stop teachers from editing the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about any existing records, since I don't have access, but it would indeed be important to check before merging this PR.
@@ -187,6 +187,27 @@ | |||
expect { convert_to_exercise_service.save! }.to change(Exercise, :count).by(1) | |||
end | |||
|
|||
context 'with two files with similar contents' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize for my lack of understanding. Should we not ensure that the exported file has no duplicates? Won't we have the same issue in CodeHarbor after exporting the it from CodeHarbor and importing it again to CodeHarbor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the duplicates some requirement in the ProformaXML spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be preferable to also fix the export of CodeHarbor, since I only addressed the import of tasks with multi-referenced files and not the export.
It would be even better to enable CodeHarbor to support the multi-referenced files directly (which would require a serious time investment).
path