Skip to content

Conversation

kkoehn
Copy link
Contributor

@kkoehn kkoehn commented Aug 5, 2025

  • adds deduplication when the same file is used multiple times (occurs when importing to CodeHarbor and the export to CodeOcean)
  • adds validation for File path

Copy link

codecov bot commented Aug 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.26%. Comparing base (152b140) to head (d1c54e4).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kkoehn kkoehn force-pushed the 3004-improve-proforma-compatibility-between-codeocean-and-codeharbor-for-multi-referenced-files branch from ca97dd2 to 626892a Compare August 5, 2025 20:16
@kkoehn kkoehn force-pushed the 3004-improve-proforma-compatibility-between-codeocean-and-codeharbor-for-multi-referenced-files branch from 626892a to d1c54e4 Compare August 5, 2025 20:38
@@ -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]}
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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).

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.

Improve ProFormA compatibility between CodeOcean and CodeHarbor for multi-referenced files
2 participants