CSC/ECE 517 Spring 2023 E2318: Reimplement Participants Controller: Difference between revisions
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
The participants controller manages the participants across these courses and assignments by providing functionalities like listing all participants, adding a participant to a course or an assignment, updating the authorizations of a participant (can_submit, can_review, can_take_quiz), deleting a participant, inheriting participants from a course to an assignment, bequeath assignment participants to the corresponding course, changing the handle name of a participant in an assignment, and deleting a participant from an assignment. | The participants controller manages the participants across these courses and assignments by providing functionalities like listing all participants, adding a participant to a course or an assignment, updating the authorizations of a participant (can_submit, can_review, can_take_quiz), deleting a participant, inheriting participants from a course to an assignment, bequeath assignment participants to the corresponding course, changing the handle name of a participant in an assignment, and deleting a participant from an assignment. | ||
== Project Goals == | |||
#Modify add participants functionality to pass only user ID instead of username in add_participant method calls | |||
#Update_authorizations method: Determine the need for a parent_id and eliminate the method if it is required | |||
#Destroy method - Add validations to make sure that the user is not on another team before destroying. | |||
#View_copyright_grants - This method is only populating DB values right now. This is to indicate whether a participant has consented for his work to be used outside the course. This method is not needed. | |||
#Get_user_info and Get_signup_topics - these methods are not needed | |||
====Additional changes==== | |||
#Allow a course to inherit all participants from an assignment | |||
#Allow a course to bequeath all participants to an assignment | |||
#<TBD> | |||
== Implementation == | == Implementation == | ||
As part of the re-implementation, the objective is to employ an API-first approach while maintaining all the existing functionality in an efficient, robust and simple manner. Specifically for the participants controller, we've added seven different API endpoints to extend the current functionalities while modifying the code to support these APIs. The details for these endpoints can be found below. | |||
---- | |||
=== API documentation === | |||
{| class="wikitable" style="width: 100%; | {| class="wikitable" style="width: 100%; | ||
Line 51: | Line 65: | ||
|} | |} | ||
=== Index === | ==== Index ==== | ||
'''Purpose''': Returns a list of participants of an assignment or a course | '''Purpose''': Returns a list of participants of an assignment or a course | ||
'''Description''': This endpoint allows the user to request a list of all participants for the provided assignment ID or course ID. A success response renders a JSON with a list of participants that can be parsed by the front-end. | '''Description''': This endpoint allows the user to request a list of all participants for the provided assignment ID or course ID. A success response renders a JSON with a list of participants that can be parsed by the front-end. | ||
'''Path''': <code>/participants/index/:model/:id</code> | '''Path''': GET <code>/participants/index/:model/:id</code> | ||
'''Parameters''': | '''Parameters''': | ||
Line 73: | Line 85: | ||
|} | |} | ||
'''Response''': | |||
<pre> | <pre> | ||
Success | |||
{ | { | ||
"model_object": model_object, | "model_object": model_object, | ||
Line 80: | Line 93: | ||
} | } | ||
status: :ok | status: :ok | ||
Failure | |||
{ | { | ||
error: "Missing or invalid required parameters" | error: "Missing or invalid required parameters" | ||
Line 90: | Line 101: | ||
</pre> | </pre> | ||
=== Create === | ==== Create ==== | ||
'''Purpose''': Creates a participant in an assignment or a course | '''Purpose''': Creates a participant in an assignment or a course | ||
'''Description''': This endpoint allows the user to create a new participant for the provided assignment ID or course ID. A success response renders a JSON with the participant details. The user is required to provide a valid username as well as the appropriate permissions for the new participant. These permissions are <code>[can_submit, can_review, can_take_quiz]</code>. Depending on whether the request is for an <code>Assignment</code> or a <code>Course</code>, a participant type is determined between an <code>AssignmentParticipant</code> or a <code>CourseParticipant</code> and an entry is made into the database accordingly. | '''Description''': This endpoint allows the user to create a new participant for the provided assignment ID or course ID. A success response renders a JSON with the participant details. The user is required to provide a valid username as well as the appropriate permissions for the new participant. These permissions are <code>[can_submit, can_review, can_take_quiz]</code>. Depending on whether the request is for an <code>Assignment</code> or a <code>Course</code>, a participant type is determined between an <code>AssignmentParticipant</code> or a <code>CourseParticipant</code> and an entry is made into the database accordingly. | ||
'''Path''': <code>/participants/:model/:id/:authorization</code> | '''Path''': POST <code>/participants/:model/:id/:authorization</code> | ||
'''Parameters''': | '''Parameters''': | ||
Line 121: | Line 130: | ||
'''Response''': | '''Response''': | ||
<pre> | <pre> | ||
Success | |||
{ | { | ||
"participant": participant, | "participant": participant, | ||
} | } | ||
status: :created | status: :created | ||
When user does not exist | When user does not exist | ||
{ | { | ||
error: "User #{params[:user][:name]} does not exist" | error: "User #{params[:user][:name]} does not exist" | ||
} | } | ||
status: :not_found | status: :not_found | ||
When participant already exists in the assignment/course | When participant already exists in the assignment/course | ||
{ | { | ||
error: "Participant #{params[:user][:name]} already exists for this #{params[:model]}" | error: "Participant #{params[:user][:name]} already exists for this #{params[:model]}" | ||
Line 146: | Line 150: | ||
</pre> | </pre> | ||
=== Update Handle === | ==== Update Handle ==== | ||
'''Purpose''': Updates the participant's handle for an assignment | '''Purpose''': Updates the participant's handle for an assignment | ||
'''Description''': This endpoint allows the user to change their handle name for a given <code>AssignmentParticipant</code>. An <code>AssignmentParticipant</code> is one who is already enrolled in the assignment. A success response renders a JSON with the updated participant details. The user is required to provide a valid and available handle name. | '''Description''': This endpoint allows the user to change their handle name for a given <code>AssignmentParticipant</code>. An <code>AssignmentParticipant</code> is one who is already enrolled in the assignment. A success response renders a JSON with the updated participant details. The user is required to provide a valid and available handle name. | ||
'''Path''': <code>/participants/change_handle/:id</code> | '''Path''': POST <code>/participants/change_handle/:id</code> | ||
'''Parameters''': | '''Parameters''': | ||
Line 169: | Line 171: | ||
'''Response''': | '''Response''': | ||
<pre> | |||
When handle change was successful | When handle change was successful | ||
{ | { | ||
"participant": participant, | "participant": participant, | ||
} | } | ||
status: :ok | status: :ok | ||
When handle is already in use | When handle is already in use | ||
{ | { | ||
note: "Handle already in use" | note: "Handle already in use" | ||
} | } | ||
status: :ok | status: :ok | ||
Failure | |||
{ | { | ||
error: participant.errors | error: participant.errors | ||
Line 194: | Line 192: | ||
</pre> | </pre> | ||
=== Update authorizations === | ==== Update authorizations ==== | ||
'''Purpose''': Updates the participant's permissions for an assignment or a course depending on the role | '''Purpose''': Updates the participant's permissions for an assignment or a course depending on the role | ||
'''Description''': This endpoint allows the user to change the permissions for a given <code>Participant</code>. The appropriate permissions for any participant are <code>[can_submit, can_review, can_take_quiz]</code>. A <code>Participant</code> is one who is already enrolled in an assignment or a course. A success response renders a JSON with the updated participant details and permissions. | '''Description''': This endpoint allows the user to change the permissions for a given <code>Participant</code>. The appropriate permissions for any participant are <code>[can_submit, can_review, can_take_quiz]</code>. A <code>Participant</code> is one who is already enrolled in an assignment or a course. A success response renders a JSON with the updated participant details and permissions. | ||
'''Path''': <code>/participants/update_authorizations/:id/:authorization</code> | '''Path''': POST <code>/participants/update_authorizations/:id/:authorization</code> | ||
'''Parameters''': | '''Parameters''': | ||
Line 229: | Line 225: | ||
'''Response''': | '''Response''': | ||
<pre> | <pre> | ||
Success | |||
{ | { | ||
"participant": participant, | "participant": participant, | ||
} | } | ||
status: :ok | status: :ok | ||
Failure | |||
{ | { | ||
error: participant.errors | error: participant.errors | ||
Line 244: | Line 240: | ||
</pre> | </pre> | ||
=== Delete === | ==== Delete ==== | ||
'''Purpose''': Deletes a participant from an assignment or a course | '''Purpose''': Deletes a participant from an assignment or a course | ||
'''Description''': This endpoint allows the user to delete an existing participant from an assignment or a course. The user is expected to provide the valid participant ID. The participant is only deleted if they are not part of another team for a different assignment/course. This is to ensure that a participant enrolled in two different teams is not deleted from the list of participants. Deletion is only possible if the participant is only enrolled in only one team. A success response renders a JSON with a confirmation of the deletion. | '''Description''': This endpoint allows the user to delete an existing participant from an assignment or a course. The user is expected to provide the valid participant ID. The participant is only deleted if they are not part of another team for a different assignment/course. This is to ensure that a participant enrolled in two different teams is not deleted from the list of participants. Deletion is only possible if the participant is only enrolled in only one team. A success response renders a JSON with a confirmation of the deletion. | ||
'''Path''': <code>/participants/:id</code> | '''Path''': DELETE <code>/participants/:id</code> | ||
'''Parameters''': | '''Parameters''': | ||
Line 263: | Line 257: | ||
'''Response''': | '''Response''': | ||
<pre> | <pre> | ||
Success | |||
{ | { | ||
message: "#{participant.user.name} was successfully removed as a participant" | message: "#{participant.user.name} was successfully removed as a participant" | ||
} | } | ||
status: :ok | status: :ok | ||
When the participant is on another team | When the participant is on another team | ||
{ | { | ||
error: "This participant is on a team" | error: "This participant is on a team" | ||
} | } | ||
status: :unprocessable_entity | status: :unprocessable_entity | ||
Failure | |||
{ | { | ||
error: "Failed to remove participant" | error: "Failed to remove participant" | ||
Line 287: | Line 278: | ||
</pre> | </pre> | ||
=== Inherit === | ==== Inherit ==== | ||
'''Purpose''': Copies existing participants from a course down to its assignment | '''Purpose''': Copies existing participants from a course down to its assignment | ||
'''Description''': This endpoint allows the user to copy the existing participants from a course to the provided assignment in a single operation. Before this is carried out, validations are performed on 1) the existence of a course for the provided assignment and 2) non-empty list of participants already registered in the course. After these checks, the participants are copied from the course to the given assignment. A success response renders a JSON with a confirmation of the copy. | '''Description''': This endpoint allows the user to copy the existing participants from a course to the provided assignment in a single operation. Before this is carried out, validations are performed on 1) the existence of a course for the provided assignment and 2) non-empty list of participants already registered in the course. After these checks, the participants are copied from the course to the given assignment. A success response renders a JSON with a confirmation of the copy. | ||
'''Path''': <code>/participants/inherit/:id</code> | '''Path''': GET <code>/participants/inherit/:id</code> | ||
'''Parameters''': | '''Parameters''': | ||
Line 306: | Line 295: | ||
'''Response''': | '''Response''': | ||
<pre> | |||
When copy was successful | When copy was successful | ||
{ | { | ||
message: "The participants from #{source.name} were copied to #{target.name}" | message: "The participants from #{source.name} were copied to #{target.name}" | ||
} | } | ||
status: :created | status: :created | ||
When all the participants already existed in the assignment(no-op) | When all the participants already existed in the assignment(no-op) | ||
{ | { | ||
note: "All of #{source.name} participants are already in #{target.name}" | note: "All of #{source.name} participants are already in #{target.name}" | ||
} | } | ||
status: :ok | status: :ok | ||
When there were no participants for the course | When there were no participants for the course | ||
{ | { | ||
note: "No participants were found for this #{source.name}" | note: "No participants were found for this #{source.name}" | ||
} | } | ||
status: :ok | status: :ok | ||
When there is no course for the given assignment | When there is no course for the given assignment | ||
{ | { | ||
error: "No course was found for this assignment" | error: "No course was found for this assignment" | ||
Line 340: | Line 322: | ||
</pre> | </pre> | ||
=== Bequeath === | ==== Bequeath ==== | ||
'''Purpose''': Copies existing participants from an assignment up to its course | '''Purpose''': Copies existing participants from an assignment up to its course | ||
'''Description''': This endpoint allows the user to copy the existing participants from the provided assignment to its associated course in a single operation. Before this is carried out, validations are performed on 1) the existence of a course for the provided assignment and 2) non-empty list of participants already registered in the assignment. After these checks, the participants are copied from the given assignment to its course. A success response renders a JSON with a confirmation of the copy. | '''Description''': This endpoint allows the user to copy the existing participants from the provided assignment to its associated course in a single operation. Before this is carried out, validations are performed on 1) the existence of a course for the provided assignment and 2) non-empty list of participants already registered in the assignment. After these checks, the participants are copied from the given assignment to its course. A success response renders a JSON with a confirmation of the copy. | ||
'''Path''': GET <code>/participants/bequeath/:id</code> | |||
'''Path''': <code>/participants/bequeath/:id</code> | |||
'''Parameters''': | '''Parameters''': | ||
Line 360: | Line 339: | ||
'''Response''': | '''Response''': | ||
<pre> | |||
When copy was successful | When copy was successful | ||
{ | { | ||
message: "The participants from #{source.name} were copied to #{target.name}" | message: "The participants from #{source.name} were copied to #{target.name}" | ||
} | } | ||
status: :created | status: :created | ||
When all the participants already existed in the course(no-op) | When all the participants already existed in the course(no-op) | ||
{ | { | ||
note: "All of #{source.name} participants are already in #{target.name}" | note: "All of #{source.name} participants are already in #{target.name}" | ||
} | } | ||
status: :ok | status: :ok | ||
When there were no participants for the assignment | When there were no participants for the assignment | ||
{ | { | ||
note: "No participants were found for this #{source.name}" | note: "No participants were found for this #{source.name}" | ||
} | } | ||
status: :ok | status: :ok | ||
When there is no course for the given assignment | When there is no course for the given assignment | ||
{ | { | ||
error: "No course was found for this assignment" | error: "No course was found for this assignment" | ||
Line 393: | Line 365: | ||
status: :unprocessable_entity | status: :unprocessable_entity | ||
</pre> | </pre> | ||
---- | |||
=== Assumptions === | |||
<TBD> | |||
== Test Plan == | == Test Plan == | ||
[https:// | |||
Since Expertiza has been originally tested with RSpec, we have continued to use RSpec to test out model. The participants_controller.rb depends on many methods and associations with other models. To test the methods in the participants controller, we have stubbed some of these dependent methods. To progress with our testing, we've added the associations in the respective sample model files since these were necessary for stubbing. | |||
====Note==== | |||
To run the tests, kindly pull from the [https://github.com/devashish-vachhani/reimplementation-back-end/ repository] and run bundle install to install the necessary dependencies. Once done, please run <code>rspec participants_controller_spec.rb</code>. | |||
====Tests==== | |||
{| class="wikitable" style="margin-left:40px" | |||
|- | |||
! Test ID !! Test Description | |||
|- | |||
| 1 || Test to check index with Assignment model and id | |||
|- | |||
| 2 || Test to check index with Course model and id | |||
|- | |||
| 3 || Test to check index with a non-existent id | |||
|- | |||
| 4 || Test to create a new participant | |||
|- | |||
| 5 || Test to confirm update handle request for a participant | |||
|- | |||
| 6 || Test to verify failure of an update handle request for a participant | |||
|- | |||
| 7 || Test to update authorizations for a participant | |||
|- | |||
| 8 || Test to verify failure of an update authorizations request for a participant | |||
|- | |||
| 9 || Test to inherit participants from a Course to an Assignment | |||
|- | |||
| 10 || Test to verify failure for inherit participants from a Course to an Assignment when course had no participants | |||
|- | |||
| 11 || Test to inherit participants from an Assignment to a Course | |||
|- | |||
| 12 || Test to verify failure for inherit participants from an Assignment to a Course when assignment had no participants | |||
|- | |||
| 13 || Test to destroy a participant | |||
|- | |||
| 14 || Test to verify failure of destroying a participant | |||
|- | |||
| 15 || Test to verify denying the destroy method for a participant who is on another team | |||
|} | |||
== Contributors == | == Contributors == | ||
Line 407: | Line 426: | ||
* '''Github Repository for old code:''' https://github.com/expertiza/expertiza/blob/main/app/controllers/participants_controller.rb | * '''Github Repository for old code:''' https://github.com/expertiza/expertiza/blob/main/app/controllers/participants_controller.rb | ||
* '''Pull Request:''' https://github.com/expertiza/reimplementation-back-end/pull/22 | * '''Pull Request:''' https://github.com/expertiza/reimplementation-back-end/pull/22 | ||
* '''Testing video:''' https://drive.google.com/file/d/1gR6adaEzAyWWg3z_s-aPbaxE2cscXDlP/view?ts=641f6906 | |||
* '''VCL Server:''' http://152.7.176.119 | * '''VCL Server:''' http://152.7.176.119 |
Revision as of 18:36, 27 March 2023
Introduction
Expertiza is an Open Source Rails application which is used by instructors and students for creating assignments and submitting peer reviews. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and also review each other's assignments. Expertiza supports submissions across various document types, including URLs and wiki pages. The Source code of the application can be cloned from Github.
Background
In expertiza, there are three different types of users - normal users (typically students), administrators, super administrators. A normal user can participate in a course or an assignment or both. Courses and assignments are different entities in the system which allow enrollment of users. While a course is an independent entity, an assignment is part of a course.
The participants controller manages the participants across these courses and assignments by providing functionalities like listing all participants, adding a participant to a course or an assignment, updating the authorizations of a participant (can_submit, can_review, can_take_quiz), deleting a participant, inheriting participants from a course to an assignment, bequeath assignment participants to the corresponding course, changing the handle name of a participant in an assignment, and deleting a participant from an assignment.
Project Goals
- Modify add participants functionality to pass only user ID instead of username in add_participant method calls
- Update_authorizations method: Determine the need for a parent_id and eliminate the method if it is required
- Destroy method - Add validations to make sure that the user is not on another team before destroying.
- View_copyright_grants - This method is only populating DB values right now. This is to indicate whether a participant has consented for his work to be used outside the course. This method is not needed.
- Get_user_info and Get_signup_topics - these methods are not needed
Additional changes
- Allow a course to inherit all participants from an assignment
- Allow a course to bequeath all participants to an assignment
- <TBD>
Implementation
As part of the re-implementation, the objective is to employ an API-first approach while maintaining all the existing functionality in an efficient, robust and simple manner. Specifically for the participants controller, we've added seven different API endpoints to extend the current functionalities while modifying the code to support these APIs. The details for these endpoints can be found below.
API documentation
# | Method | Endpoint | Description |
---|---|---|---|
1 | Index | GET /participants/index/:model/:id
|
Returns a list of participants of an assignment or a course |
2 | Create | POST /participants/:model/:id/:authorization
|
Creates a participant in an assignment or a course |
3 | Update Handle | POST /participants/change_handle/:id
|
Updates the participant's handle for an assignment |
4 | Update Authorizations | POST /participants/update_authorizations/:id/:authorization
|
Updates the participant's permissions for an assignment or a course depending on the role |
5 | Delete | DELETE /participants/:id
|
Deletes a participant from an assignment or a course |
6 | Inherit | GET /participants/inherit/:id
|
Copies existing participants from a course down to its assignment |
7 | Bequeath | GET /participants/bequeath/:id
|
Copies existing participants from an assignment up to its course |
Index
Purpose: Returns a list of participants of an assignment or a course
Description: This endpoint allows the user to request a list of all participants for the provided assignment ID or course ID. A success response renders a JSON with a list of participants that can be parsed by the front-end.
Path: GET /participants/index/:model/:id
Parameters:
# | Parameter | Expected Value |
---|---|---|
1 | model
|
One of these two strings: ['Assignment', 'Course']
|
2 | id
|
The unique identifier for an assignment or a course depending on the value of :model
|
Response:
Success { "model_object": model_object, "participants": participants, } status: :ok Failure { error: "Missing or invalid required parameters" } status: :unprocessable_entity
Create
Purpose: Creates a participant in an assignment or a course
Description: This endpoint allows the user to create a new participant for the provided assignment ID or course ID. A success response renders a JSON with the participant details. The user is required to provide a valid username as well as the appropriate permissions for the new participant. These permissions are [can_submit, can_review, can_take_quiz]
. Depending on whether the request is for an Assignment
or a Course
, a participant type is determined between an AssignmentParticipant
or a CourseParticipant
and an entry is made into the database accordingly.
Path: POST /participants/:model/:id/:authorization
Parameters:
# | Parameter | Expected Value |
---|---|---|
1 | model
|
One of these two strings: ['Assignment', 'Course']
|
2 | id
|
The unique identifier for an assignment or a course depending on the value of :model
|
3 | username
|
The unique username of the new participant being requested |
4 | authorization
|
A list of required permissions for the requested new particpant |
Response:
Success { "participant": participant, } status: :created When user does not exist { error: "User #{params[:user][:name]} does not exist" } status: :not_found When participant already exists in the assignment/course { error: "Participant #{params[:user][:name]} already exists for this #{params[:model]}" } status: :unprocessable_entity
Update Handle
Purpose: Updates the participant's handle for an assignment
Description: This endpoint allows the user to change their handle name for a given AssignmentParticipant
. An AssignmentParticipant
is one who is already enrolled in the assignment. A success response renders a JSON with the updated participant details. The user is required to provide a valid and available handle name.
Path: POST /participants/change_handle/:id
Parameters:
# | Parameter | Expected Value |
---|---|---|
1 | id
|
The unique identifier for an AssignmentParticipant
|
2 | handle
|
A valid, available handle name for the participant |
Response:
When handle change was successful { "participant": participant, } status: :ok When handle is already in use { note: "Handle already in use" } status: :ok Failure { error: participant.errors } status: :unprocessable_entity
Update authorizations
Purpose: Updates the participant's permissions for an assignment or a course depending on the role
Description: This endpoint allows the user to change the permissions for a given Participant
. The appropriate permissions for any participant are [can_submit, can_review, can_take_quiz]
. A Participant
is one who is already enrolled in an assignment or a course. A success response renders a JSON with the updated participant details and permissions.
Path: POST /participants/update_authorizations/:id/:authorization
Parameters:
# | Parameter | Expected Value |
---|---|---|
1 | id
|
The unique identifier for a Participant
|
2 | authorization
|
A list of permissions being requested for the participant |
3 | can_submit
|
A value for whether the participant can make submissions or not. |
4 | can_review
|
A value for whether the participant can create reviews or not. |
5 | can_take_quiz
|
A value for whether the participant can take quizzes or not. |
Response:
Success { "participant": participant, } status: :ok Failure { error: participant.errors } status: :unprocessable_entity
Delete
Purpose: Deletes a participant from an assignment or a course
Description: This endpoint allows the user to delete an existing participant from an assignment or a course. The user is expected to provide the valid participant ID. The participant is only deleted if they are not part of another team for a different assignment/course. This is to ensure that a participant enrolled in two different teams is not deleted from the list of participants. Deletion is only possible if the participant is only enrolled in only one team. A success response renders a JSON with a confirmation of the deletion.
Path: DELETE /participants/:id
Parameters:
# | Parameter | Expected Value |
---|---|---|
1 | id
|
The unique identifier for a Participant
|
Response:
Success { message: "#{participant.user.name} was successfully removed as a participant" } status: :ok When the participant is on another team { error: "This participant is on a team" } status: :unprocessable_entity Failure { error: "Failed to remove participant" } status: :unprocessable_entity
Inherit
Purpose: Copies existing participants from a course down to its assignment
Description: This endpoint allows the user to copy the existing participants from a course to the provided assignment in a single operation. Before this is carried out, validations are performed on 1) the existence of a course for the provided assignment and 2) non-empty list of participants already registered in the course. After these checks, the participants are copied from the course to the given assignment. A success response renders a JSON with a confirmation of the copy.
Path: GET /participants/inherit/:id
Parameters:
# | Parameter | Expected Value |
---|---|---|
1 | id
|
The unique identifier for an Assignment
|
Response:
When copy was successful { message: "The participants from #{source.name} were copied to #{target.name}" } status: :created When all the participants already existed in the assignment(no-op) { note: "All of #{source.name} participants are already in #{target.name}" } status: :ok When there were no participants for the course { note: "No participants were found for this #{source.name}" } status: :ok When there is no course for the given assignment { error: "No course was found for this assignment" } status: :unprocessable_entity
Bequeath
Purpose: Copies existing participants from an assignment up to its course
Description: This endpoint allows the user to copy the existing participants from the provided assignment to its associated course in a single operation. Before this is carried out, validations are performed on 1) the existence of a course for the provided assignment and 2) non-empty list of participants already registered in the assignment. After these checks, the participants are copied from the given assignment to its course. A success response renders a JSON with a confirmation of the copy.
Path: GET /participants/bequeath/:id
Parameters:
# | Parameter | Expected Value |
---|---|---|
1 | id
|
The unique identifier for an Assignment
|
Response:
When copy was successful { message: "The participants from #{source.name} were copied to #{target.name}" } status: :created When all the participants already existed in the course(no-op) { note: "All of #{source.name} participants are already in #{target.name}" } status: :ok When there were no participants for the assignment { note: "No participants were found for this #{source.name}" } status: :ok When there is no course for the given assignment { error: "No course was found for this assignment" } status: :unprocessable_entity
Assumptions
<TBD>
Test Plan
Since Expertiza has been originally tested with RSpec, we have continued to use RSpec to test out model. The participants_controller.rb depends on many methods and associations with other models. To test the methods in the participants controller, we have stubbed some of these dependent methods. To progress with our testing, we've added the associations in the respective sample model files since these were necessary for stubbing.
Note
To run the tests, kindly pull from the repository and run bundle install to install the necessary dependencies. Once done, please run rspec participants_controller_spec.rb
.
Tests
Test ID | Test Description |
---|---|
1 | Test to check index with Assignment model and id |
2 | Test to check index with Course model and id |
3 | Test to check index with a non-existent id |
4 | Test to create a new participant |
5 | Test to confirm update handle request for a participant |
6 | Test to verify failure of an update handle request for a participant |
7 | Test to update authorizations for a participant |
8 | Test to verify failure of an update authorizations request for a participant |
9 | Test to inherit participants from a Course to an Assignment |
10 | Test to verify failure for inherit participants from a Course to an Assignment when course had no participants |
11 | Test to inherit participants from an Assignment to a Course |
12 | Test to verify failure for inherit participants from an Assignment to a Course when assignment had no participants |
13 | Test to destroy a participant |
14 | Test to verify failure of destroying a participant |
15 | Test to verify denying the destroy method for a participant who is on another team |
Contributors
- Saksham Pandey (spandey5@ncsu.edu)
- Devashish Vachhani (dvachha@ncsu.edu)
- Karthik K Jayakumar (kkunnum@ncsu.edu)
Mentor: Rucha Kolekar (rbkoleka@ncsu.edu)
Relevant Links
- Github Repository for new code: https://github.com/devashish-vachhani/reimplementation-back-end
- Github Repository for old code: https://github.com/expertiza/expertiza/blob/main/app/controllers/participants_controller.rb
- Pull Request: https://github.com/expertiza/reimplementation-back-end/pull/22
- Testing video: https://drive.google.com/file/d/1gR6adaEzAyWWg3z_s-aPbaxE2cscXDlP/view?ts=641f6906
- VCL Server: http://152.7.176.119