CSC/ECE 517 Fall 2023 - E2366. Reimplement assignment model and assignment controller: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
(Created page with "==Expertiza== [http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects,...")
 
No edit summary
Line 96: Line 96:
[[File:Delete_assignment-POSTMAN.jpeg | 500px]]
[[File:Delete_assignment-POSTMAN.jpeg | 500px]]


*Copy_assignment- POSTMAN
[[File:Copy assignment-POSTMAN.jpeg | 500px]]


*Original Assignment - rails console
*Original Assignment - rails console

Revision as of 20:01, 30 October 2023

Expertiza

Expertiza is a Ruby on Rails based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.

Problem Statement

A reimplementation was required for assignment model and assignment controller. The following tasks were required for the reimplementation :

  1. Creating necessary associations between assignment model and other models such as course, participants, instructor.
  2. Reimplementation for the following methods in assignment model and necessary controller actions and routes :
    • add_participant  : Allows a user with an appropriate role to add a participant to an assignment
    • remove_participant  : Allows a user with an appropriate role to remove a participant from an assignment.
    • assign_courses_to_assignment  : Associates the assignments with a given course.
    • remove_assignment_from_course : Dissociates an assignment from a course.
    • copy_assignment  : Creates a copy of an assignment
    • delete  : CRUD operation for deleting the assignment and necessary dependencies.
    • Writing rspec and rswag test case for assignment model and controller respectively.


Documentation for methods that were re- implemented:

  1. add_participant
    • HTTP Method: POST
    • Endpoint: api/v1/{assignment_id}/add_participant/{user_id}
    • Input: assignment_id, user_id
    • Output: Response code and JSON of assignment participant
    • Description: It allows super admins, admins, instructors, and teaching assistants to add a particular participant (student) from the given assignment.
  1. remove_participant
    • HTTP Method: DELETE
    • Endpoint: api/v1/{assignment_id}/remove_participant/{user_id}
    • Input: assignment_id, user_id
    • Output: Response code
    • Description: It allows super admins, admins, instructors, and teaching assistants to remove a particular participant (student) from the given assignment.
  1. remove_assignment_from_course
    • HTTP Method: PATCH
    • Endpoint: api/v1/{assignment_id}/remove_assignment_from_course
    • Input: assignment_id
    • Output: Response code and JSON of updated assignment
    • Description: It makes the course_id of the given assignment null (removes the assignment from its course).
  1. assign_courses_to_assignment
    • HTTP Method: PATCH
    • Endpoint: api/v1/{assignment_id}/assign_courses_to_assignment/{course_id}
    • Input: assignment_id, course_id
    • Output: Response code and JSON of updated assignment
    • Description: It assigns the given course_id to the given assignment.
  1. destroy(delete_assignment)
    • HTTP Method: DELETE
    • Endpoint:api/v1/assignment/{assignment_id}
    • Input: assignment_id
    • Output: Response code
    • Description: It deletes the specified assignment.
  1. copy_assignment
    • HTTP Method: POST
    • Endpoint: api/v1/{assignment_id}/copy_assignment
    • Input: assignment_id
    • Output: Response code and JSON of copied assignment.
    • Description: It copies the assignment and stores the copy with the name “Copy of” + the original assignment name.


Files added / modified

  • reimplementation-back-end/blob/main/app/models/course.rb
  • reimplementation-back-end/blob/main/app/models/assignment.rb
  • reimplementation-back-end/blob/main/app/models/assignment_participant.rb
  • reimplementation-back-end/blob/main/app/controllers/api/v1/assignments_controller.rb
  • reimplementation-back-end/blob/main/db/schema.rb

Manual Testing Using POSTMAN

Postman was used for manually testing the added method in assignment.rb and their respective controllers actions and routes. Before testing any of these methods using Postman, a request to /login needs to be sent with user_name an password fields which sends a authentication token. This token needs to be added in Postman’s ‘Authorization’ tab as ‘Bearer token’ before any further requests can be made.



  • add_participant - POSTMAN

  • new participant created - rails console

  • remove_participant - POSTMAN

  • remove_assignment_from_course - POSTMAN

  • assign_courses_to_assignment - POSTMAN

  • destroy(delete_assignment) - POSTMAN

  • Copy_assignment- POSTMAN

  • Original Assignment - rails console

  • Copied Assignment - rails console

Team

Mentor
  • Ameya Vaichalkar
Members
  • Bhavya Harchandani <bharcha@ncsu.edu>
  • Akshat Saxena<asaxen24@ncsu.edu>
  • Mitali Sethi <msethi@ncsu.edu>

Pull Request

References