Comments (3)
In CodeHarbor we work with assign_attributes
@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. parent_uuid
will get overwritten, because it's part of proforma. access_level
is not touched and will also stay the same. For some reason user
is overwritten - I would suggest removing that part, because I don't see a reason to change the ownership of a task because of an import.
from codeharbor.
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 user
just like in CH.
We do, however, replace existing files by creating new ones and deleting the old ones. If any data is linked to the files, we might have to take a look at that.
from codeharbor.
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:
- Overwriting the
parent_uuid
in general is fine. However, in conjunction with CodeOcean that's problematic since CodeOcean is not aware of anyparent_uuid
. Imagine I export a CodeHarbor task to CodeOcean which had aparent_uuid
set. After some changes in CodeOcean, I re-export the very same task back to CodeHarbor, which would result in loosing theparent_uuid
. This should be fixed, so that theparent_uuid
is not lost (maybe by exporting it to CodeOcean as well?) - Overwriting
user
is odd, and should be removed. We won't update the user when updating the task through the CodeHarbor UI. - Do I get right that we are also re-creating
tests
,model_solutions
, andfiles
in CodeHarbor completely (and dropping the previous objects)? This mightchangeoverwrite thecreated_at
value and:Test#validity
Test#timeout
Test#testing_framework
- ... is probably an issue with the new
parent_id
introduced in #1103 for threetests
,model_solutions
, andfiles
, since these IDs might need an update, too: For a valid task, none of these values is ever set (only for a contribution), but the ID saved in other objects could refer to one of the artifacts being updated through a ProFormA import.
CodeOcean:
- Reassigning the
user
is not too problematic, since this mirrors the behavior for updates through the UI (where we also change the user). Not ideal, but should be addressed together, I'd say. - Similarly to CodeHarbor, we have an issue with recreating the files: The file ID of an exercise is used several times. For one, it is used as a target in the
CodeOcean::Files
for the columnfile_id
when thecontext_type
is set toSubmission
(same design principle as with theparent_id
in CodeHarbor). Further, it is also used inTestruns
for columnfile_id
. Potentially,RequestForComments
(andLinterCheckRun
) is also affected. - Otherwise, I am not aware of other data being linked to files (they are rather linked to the exercise, which is fine).
That having said, I am afraid we probably need to change some of the behavior (mainly to keep and update the existing objects).
from codeharbor.
Related Issues (20)
- Task Collection Rank: Improve validity and reverse numbers
- Collection: Redirect to Show on Update
- Task Update: Scroll to top of page
- Task Index: Improve Search
- Collection: Index Page doesn't show tasks in order
- OmniAuth login: Add switch to control auto-update of attributes
- UserIdentities are not destroyed with User
- TaskFiles: Cannot be referenced multiple times HOT 2
- ProFormA import: Task name is not shown on error
- Share collection: Pop-up too narrow in German HOT 2
- Share collection: Notify users via email
- Share collection: Re-invite member who left previously
- Collections: Allow user management HOT 2
- Share collection: Notify about invalid email addresses
- Share collection: Notify about acceptance of invitation
- "Remember me" check box is not aligned
- Select2 won't load on Turbolinks navigation
- More fine granular rating system with sub-categories HOT 1
- ArgumentError on tasks#index
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codeharbor.