-
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
TaskContributions #1103
TaskContributions #1103
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1103 +/- ##
==========================================
+ Coverage 94.21% 94.77% +0.56%
==========================================
Files 123 130 +7
Lines 3042 3330 +288
==========================================
+ Hits 2866 3156 +290
+ Misses 176 174 -2 ☔ View full report in Codecov by Sentry. |
This comment was marked as resolved.
This comment was marked as resolved.
77990b7
to
993c9bd
Compare
2fce162
to
f4a36c0
Compare
dab60d6
to
7e403cf
Compare
de2aae1
to
184496b
Compare
ed2f939
to
3789190
Compare
bfde752
to
ae6205e
Compare
This comment was marked as resolved.
This comment was marked as resolved.
ce776a3
to
9b10a06
Compare
9b10a06
to
a462813
Compare
8b0294f
to
141a4da
Compare
app/views/task_contribution_mailer/contribution_request.html.slim
Outdated
Show resolved
Hide resolved
app/views/task_contribution_mailer/contribution_request.html.slim
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
30b5063
to
e6a3d44
Compare
e6a3d44
to
d169ee7
Compare
d169ee7
to
5fecfda
Compare
* Make method private * Reduce parameters and avoid passing strings of class names * Overwrite for file specifically
For now, we decided to keep the current behavior. Further investigations should happen in the future, for which we will create a new GitHub issue.
Also, use the newer syntax, so that the code is already compatible with Rails 7.2 and higher.
We recently discovered an issue where an old attachment would be incorrectly linked to an updated file after validation errors occurred. Specifically, the reproduction scenario is as follows: 1. Create a new task with a native file attached that passes all validations. 2. Edit this task and introduce a validation error that is unrelated to the file. For example, remove the task's title or language. 3. Select another native file attachment for the already existing TaskFile. 4. Attempt to save the changes 5. As expected, a validation error regarding the change is shown (title, language). Furthermore, the upload field has been cleared, since the file attachment was changed and the newly selected file was not yet saved on the server. 6. Fix the validation error and (without re-selecting the file attachment) save the task again. 7. Now, the task was saved again, despite the "missing" file attachment. However, it was expected that another validation error regarding the missing file attachment is shown. Unfortunately, the existing TaskFile also gets updated with the name of the previously selected file name (new file name, old content). During our investigation, we identified that the attachment param of TaskParameters#file_params was simply missing, despite `use_attached_file=true`. Consequentially, assigning the params as attributes to the task (and the task file respectively) did not modify the existing `attachment` relationship, so that the previously saved attachment was still "connected". With the commit at hand, we therefore set the `attachment` param to `nil` explicitly, when it is not yet present (indicating that no file was sent by the browser) and the `parent_blob_id` is not present either (indicating that the file attachment got touched in one of the previous attempts to save changes).
Since we changed the file association in 9d9ac23, the `files` method might return an array of files. For transferring values, however, we need a ActiveRecord::CollectionProxy to perform actual changes on the records. With this commit, we add an exception for the transfer of values to fix that behavior.
35bed11
to
5289a69
Compare
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.
What a huge improvement to CodeHarbor! 👏 I super happy about these changes and can't wait to see what our users will do with contributions. From my conversations with teachers, MOOC instructors and university professors, I am confident that this work can ease their workflows and support in better teaching 💪
Thank you so much for your countless and tireless work on this topic! 💐
This PR adds initial support for TaskContributions.
Currently, this includes:
There are still some tests missing which I need to add before these changes can be merged. However, a review of the implementation is still possible.
unique_pending_contribution
can %i[update destroy], TaskContribution do |contrib|*
ParentValidation if parent_entry.blank?
TransferValues