-
Notifications
You must be signed in to change notification settings - Fork 2
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
Check task overwriting through ProFormA #1320
Comments
In CodeHarbor we work with @task.assign_attributes(
user: @user,
title: @proforma_task.title,
description:,
internal_description: @proforma_task.internal_description,
programming_language:,
uuid:,
parent_uuid: @proforma_task.parent_uuid,
language: @proforma_task.language,
meta_data: @proforma_task.meta_data,
submission_restrictions: @proforma_task.submission_restrictions,
external_resources: @proforma_task.external_resources,
grading_hints: @proforma_task.grading_hints,
tests:,
model_solutions:,
files: files.values # this line has to be last, because tests and model_solutions have to remove their respective files first
) Therefore all mentioned relations stay in place and only attributes get changed. |
In CodeOcean we do it similarly: @exercise.assign_attributes(
user: @user,
title: @task.title,
description: @task.description,
public: string_to_bool(extract_meta_data(@task.meta_data&.dig('meta-data'), 'public')) || false,
hide_file_tree: string_to_bool(extract_meta_data(@task.meta_data&.dig('meta-data'), 'hide_file_tree')) || false,
allow_file_creation: string_to_bool(extract_meta_data(@task.meta_data&.dig('meta-data'), 'allow_file_creation')) || false,
allow_auto_completion: string_to_bool(extract_meta_data(@task.meta_data&.dig('meta-data'), 'allow_auto_completion')) || false,
expected_difficulty: extract_meta_data(@task.meta_data&.dig('meta-data'), 'expected_difficulty') || 1,
execution_environment_id:,
files:
) Here me extract potentially saved meta-data in our own cool format. We reassign |
Thanks for checking! That's a valuable finding and seems to be mostly okay; we probably have to change only a few minor things: CodeHarbor:
CodeOcean:
That having said, I am afraid we probably need to change some of the behavior (mainly to keep and update the existing objects). |
Note to self: As soon as overwriting is possible without negative consequences, we should re-export all former Python 3.7 exercises from CodeOcean to CodeHarbor (they have been updated to use the Python 3.8 environment now). |
I've tested the behavior with #1612 and updated the original checklist based on this PR. With these changes, re-exporting a task to CodeHarbor is fine. However, we still need to tackle the problems in CodeOcean before closing this issue. |
I've updated the tasks on CodeHarbor, so that I don't forget doing so later. During this update, I noticed a remaining bug in #1612. As part of that, the update process falsely recreated some TaskFiles (changing their ID) which is not ideal but happened before introducing contributions. |
While reviewing openHPI/codeocean#2538 (review), I noticed we still have an issue even after merging #1612. That should be investigated before closing this issue (see the attached comment for details). |
Regarding the issue in CodeHarbor, I traced the problem to a This situation causes the deletion of the A strange issue occurs when moving I created a PR with my experiments and tests, but I was not able to find a working solution. |
Thank you for this work. I was able to reproduce the issue and didn't find an optimal solution either. Nevertheless, I've made a proposal that should resolve the issue, see #1696 (comment). |
When pushing an existing task through our ProFormA API, one gets ask whether the existing task should be overwritten (given sufficient permissions) or whether a new copy should be created. That's fine and working as expected.
My questions:
I was unsure (haven't tested it myself) and would like to know how the systems behave. If any of these data gets lost, I would strongly suggest to keep this "additional" data, only overwriting those "attributes" sent through the API.
The text was updated successfully, but these errors were encountered: