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

refactor import to reuse task_files based on xml_id #1612

Merged
merged 3 commits into from
Sep 17, 2024

Conversation

kkoehn
Copy link
Collaborator

@kkoehn kkoehn commented Aug 26, 2024

This enables the reuse of task_file, model_solution and test objects as discussed in #1320

@kkoehn kkoehn self-assigned this Aug 26, 2024
@kkoehn kkoehn linked an issue Aug 26, 2024 that may be closed by this pull request
18 tasks
Copy link

codecov bot commented Aug 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.16%. Comparing base (0161c22) to head (9467b18).
Report is 28 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1612      +/-   ##
==========================================
+ Coverage   94.14%   94.16%   +0.02%     
==========================================
  Files         123      124       +1     
  Lines        3004     3034      +30     
==========================================
+ Hits         2828     2857      +29     
- Misses        176      177       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kkoehn kkoehn force-pushed the 1320-check-task-overwriting-through-proforma branch 3 times, most recently from 4bf18ab to 832e5b5 Compare September 2, 2024 20:32
@kkoehn kkoehn marked this pull request as ready for review September 2, 2024 20:39
Copy link
Member

@MrSerth MrSerth left a comment

Choose a reason for hiding this comment

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

I've tested the changes locally and think everything works as expected 👍

There is just a comment left regarding the implementation.

@kkoehn kkoehn force-pushed the 1320-check-task-overwriting-through-proforma branch from 832e5b5 to c6f4f5a Compare September 3, 2024 19:07
@kkoehn kkoehn force-pushed the 1320-check-task-overwriting-through-proforma branch from c6f4f5a to 11265ec Compare September 3, 2024 19:11
@kkoehn kkoehn requested a review from MrSerth September 3, 2024 20:12
Copy link
Member

@MrSerth MrSerth left a comment

Choose a reason for hiding this comment

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

Very nice, thank you! 🦚

Copy link
Member

@MrSerth MrSerth left a comment

Choose a reason for hiding this comment

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

Sorry to add another issue to this PR, but I noticed an actual issue when updating changed tasks (through CodeOcean). Consider the following task in the "old" form, updated with the "new" version. (Hint: The bug is also visible through the ZIP upload)

task_845_new.zip
task_845_old.zip

The new task should contain a file for the tests, but after the update it doesn't. The test is present but without any files. Only a second update with the same "new" version "restores" (actually: recreates) the test file.

Reverting back to the old version yields a similar problem, any might optionally display an error.

@kkoehn
Copy link
Collaborator Author

kkoehn commented Sep 5, 2024

We should also double check that files get deleted, when they are not present anymore

@kkoehn
Copy link
Collaborator Author

kkoehn commented Sep 9, 2024

@MrSerth I can't seem to get a handle on the problem.
The assignment of the files is correct, but during the save some of them end up with fileable_id nil and get destroyed because of dependent: destroy the fileable_type seems to be set correctly.

Do you have an idea?

@MrSerth
Copy link
Member

MrSerth commented Sep 11, 2024

@MrSerth I can't seem to get a handle on the problem. The assignment of the files is correct, but during the save some of them end up with fileable_id nil and get destroyed because of dependent: destroy the fileable_type seems to be set correctly.

Do you have an idea?

Barely 😵‍💫. I played around with Rails for many hours and was trying many different things, until finding a suitable (not necessarily nice) solution. Your previous tests were super helpful, thanks again for this true test-driven approach!

I am not really satisfied with the approach, and I find overwriting files not ideal. However, I was really unable to find another, better solution. Fixing the "save" action was relatively easy and straight forward, but broke the modified (not saved) version. Fixing both was super hard, and the only solution that worked and did not overwrite much of the internals is the one I present. From my point of view, I find the suggestion okay-ish and would proceed with that base -- all changes are based on the public API and thus should be stable.

See my PR #1657 for details and the in-depth suggestion.

We recently discovered an edge case where a moved file was not updated correctly. At first, it got removed and recreated, and later on only removed. While these changes look pretty difficult, they are the best and only working approach I could find to fix the problem ;). For now, I'd suggest to go with this solution. See #1606 for more details.
@kkoehn kkoehn requested a review from MrSerth September 16, 2024 18:33
@kkoehn
Copy link
Collaborator Author

kkoehn commented Sep 16, 2024

@MrSerth I merged your suggestions, thanks again for the help. I think this should be finished now.

Copy link
Member

@MrSerth MrSerth left a comment

Choose a reason for hiding this comment

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

I think so too, and would consider this PR to be ready. Updating a task with moved files (as mentioned earlier in #1612 (review)) is now working correctly 🥳

@kkoehn kkoehn merged commit 9d9ac23 into master Sep 17, 2024
13 checks passed
@kkoehn kkoehn deleted the 1320-check-task-overwriting-through-proforma branch September 17, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants