-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe 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 commentThe 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). |
||
let(:file_dup) do | ||
ProformaXML::TaskFile.new( | ||
id: 'id2', | ||
content:, | ||
filename:, | ||
used_by_grader: 'used_by_grader', | ||
visible: 'yes', | ||
usage_by_lms:, | ||
binary:, | ||
mimetype: | ||
) | ||
end | ||
|
||
let(:files) { [file, file_dup] } | ||
|
||
it 'creates an exercises with only one file' do | ||
expect(convert_to_exercise_service.files.length).to be 1 | ||
end | ||
end | ||
|
||
context 'when file is a Makefile' do | ||
let(:filename) { "#{path}Makefile" } | ||
|
||
|
@@ -346,7 +367,7 @@ | |
ProformaXML::TaskFile.new( | ||
id: 'ms-file-2', | ||
content: 'content', | ||
filename: 'filename.txt', | ||
filename: 'filename2.txt', | ||
used_by_grader: 'used_by_grader', | ||
visible: 'yes', | ||
usage_by_lms: 'display', | ||
|
@@ -456,7 +477,7 @@ | |
ProformaXML::TaskFile.new( | ||
id: 'test_file_id2', | ||
content: 'testfile-content', | ||
filename: 'testfile.txt', | ||
filename: 'testfile2.txt', | ||
used_by_grader: 'yes', | ||
visible: 'no', | ||
usage_by_lms: 'display', | ||
|
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.