-
Notifications
You must be signed in to change notification settings - Fork 652
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
fix:restored removed article to available articles #6060
base: master
Are you sure you want to change the base?
fix:restored removed article to available articles #6060
Conversation
In this PR, I have added Ruby test cases for the The scenarios covered are as follows:
|
@ragesoss the test is passing locally in my system |
…ssigned-articles-5549
@ragesoss, I'm not entirely sure, but the multiwiki_assignment_spec.rb test seems to be failing after the latest commit merge. Additionally, the account_requests_spec.rb test is failing both on my local setup and in the master branch. However, this failure appears to be unrelated to the changes I made. |
@shishiro26 yes, i'm not sure why it started failing, but i'm going to look into it. |
Does this implementation differentiate articles that started as Available Articles versus ones that the student chose via title without starting as an Available Article? I think we need this to only apply for ones that started as Available Articles. |
I’m not sure if you’re referring to this one, sir User: If so, then yes, it doesn’t differentiate between the two. It removes both from the assigned ones and keeps them in the available articles, sir. |
Sir, I would like to know if there is any user-specific association, such as a user_id or something similar, that tracks whether a particular person created or added an article. Is there an existing reference to identify the user who created or added the article? From the logs I’ve seen, there are references to users, but they seem to be related to assignments rather than article creation. If such an association doesn’t currently exist, would it be possible for me to add a user_id field to the articles table and link it to the user who created or added the article? |
I think you could use |
Sir, I believe there is no change in the flags field, as it remains NULL in both cases in the SQL database. There appears to be no update to Assignment.flags. |
Right, you would need to implement that. |
okay, sir! 😄 |
Could you please review this, sir? This is just a rough implementation. If this method looks fine, the |
I will plan to review this next week. |
Okay sir |
This looks like it's going in the right direction, but from my reading of the code, I think it doesn't correctly the initial setting of flags. An "Available Articles" is an Assignment record created by the instructor of a course (or an admin) that is not linked to a user. These are the ones that are available as a list for students to select as their assignment. In contrast, a newly created assignment that is linked to a user, which happens when a student enters an article title directly rather than selecting from the Available Articles list, does not start as an Available Article. Those two situations are what the flag should keep track of: whether a new Assignment started as Available Article or not. I think feature specs should be extended to test for the new behavior. One should test for the presence of the flag when an instructor adds an Available Article, and the absence when a student adds an assigned article directly. Another should test for a student claiming and then unclaiming an assignment, verifying that the article returns to the Available list. These might be possible to test via adjusting or extending existing tests that interact with assignment features, such as my_articles_spec.rb and instructor_role_spec.rb |
Thank you for the clarification. I realized I had overlooked this situation earlier. When adding assignments, I mistakenly assumed they were directly linked to articles rather than being part of the assignments workflow. Upon reviewing, I noticed that when adding an available_article, the user_id is set to nil and it gets added to the assignments. I’ll address this issue and ensure the flags are set correctly to distinguish between "Available Articles" and directly assigned articles. Additionally, I’ll review and update the tests to align with the expected behavior. I now have a clearer understanding of the logic, but I’ll double-check the code and adjust or extend the relevant tests before committing the changes. |
…sed on article availability
I've also updated the test cases to reflect these scenarios. However, I am unsure if I should update the flags in the |
I'm not sure what you're referring to here; I don't see |
I've only added the test for available articles, while the tests for user-assigned assignments are already present and not covered in this test, sir. Also, the assigned_articles_spec.rb was running successfully on my local machine, sir. |
Could you please take a look at this, @ragesoss? |
@shishiro26 it's on my todo list, but I likely won't be able to review it until next week. @Abishekcs: if you're interested in having a look, I think your feedback would be helpful in the meantime. |
Sure, I will look into it.😄 |
...ipts/components/overview/my_articles/components/Categories/List/Assignment/Header/Header.jsx
Show resolved
Hide resolved
How about adding a "notification message" after successfully unclaiming an assignment that belonged to available articles? By dispatching an |
@@ -33,8 +33,15 @@ const isClassroomProgram = course => (course.type === 'ClassroomProgramCourse'); | |||
const unassign = ({ assignment, course, dispatch }) => { | |||
const body = { course_slug: course.slug, ...assignment }; | |||
const confirmMessage = I18n.t('assignments.confirm_deletion'); | |||
const successNotification = { |
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.
Moving the successNotification definition inside the unclaimAssignment function would be better. Since this notification is specifically tied to the success state of unclaiming an article, it makes more sense to define it within the function itself rather than passing it as a parameter.
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.
Yes, but I noticed that in other parts of the code, the notification is also being sent as a parameter. So, I kept it that way and did not change it.
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.
Yes, but I noticed that in other parts of the code, the notification is also being sent as a parameter. So, I kept it that way and did not change it.
ohh but still it would be nice to move as much as logic to redux the less parameter to pass better.
app/assets/javascripts/components/common/AssignCell/AssignButton.jsx
Outdated
Show resolved
Hide resolved
export const unclaimAssignment = (assignment, successNotification) => (dispatch) => { | ||
return API.unclaimAssignment(assignment) | ||
.then((resp) => { | ||
if (resp.assignment) { |
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.
Additionally, I am not sure but using assignment
to check for successful unclaim may not be the most reliable indicator. Instead, consider using flags
or checking if user_id
is null/undefined, as these would more explicitly confirm that the article was successfully unclaimed.
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.
Yuppp
NOTE: Please review the pull request process before opening your first PR: https://github.com/WikiEducationFoundation/WikiEduDashboard/blob/master/CONTRIBUTING.md#pull-request-process
What this PR does
This PR restores both self-assigned and admin-assigned articles back to the pool of available articles.
I have written a test case for the controller to ensure that the changes work as expected.
Screenshots
After:
https://github.com/user-attachments/assets/db77ecb3-734d-4693-94d2-cfd235297c90
Open questions and concerns
With this change, when removing an article, a dialog appears with the message: "Are you sure you want to delete this program?"
#5549