CSC/ECE 517/Spring 2023/E2332 Reimplement Courses (Refactor course.rb): Difference between revisions
Line 86: | Line 86: | ||
! Test No. !! Description | ! Test No. !! Description | ||
|- | |- | ||
| 1 || Tests if the | | 1 || Tests if the action_allowed disallows all actions when current user is student. | ||
|- | |- | ||
| 2 || Tests if the | | 2 || Tests if the action_allowed allows all course actions when current user is instructor. | ||
|- | |- | ||
| 3 || Tests if | | 3 || Tests if create method returns a 201 Created status code if the resource is successfully created. | ||
|- | |- | ||
| 4 || Tests if | | 4 || Tests if create method returns a 422 Unprocessable Entity status code if the resource cannot be created due to validation errors. | ||
|- | |- | ||
| 5 || Tests if the | | 5 || Tests if the delete method returns a 204 No Content status code if the resource is successfully deleted. | ||
|- | |- | ||
| 6 || Tests if the | | 6 || Tests if the delete method returns a 404 Not Found status code if the resource cannot be found. | ||
|- | |- | ||
| 7 || Tests if the | | 7 || Tests if the new method sets the private instance variable. | ||
|- | |- | ||
| 8 || Tests if the | | 8 || Tests if the update method returns a 200 OK status code if the resource is successfully updated. | ||
|- | |- | ||
| 9 || Tests if the | | 9 || Tests if the update method returns a 422 Unprocessable Entity status code if the resource cannot be updated due to validation errors. | ||
|- | |- | ||
| 10 || Tests if the topic_name method returns the participant topic name when not nil. | | 10 || Tests if the topic_name method returns the participant topic name when not nil. | ||
|- | |- | ||
| 11 || Tests if the | | 11 || Tests if the auto_complete_for_user_name method returns a list of users. | ||
|- | |- | ||
| 12 || Tests if the | | 12 || Tests if the copy method redirects to new course when new course id fetched successfully. | ||
|- | |- | ||
| 13 || Tests if the | | 13 || Tests if the view_teaching_assistants method returns list of TAs for the course. | ||
|- | |- | ||
| 14 || Tests if the | | 14 || Tests if the add_ta method returns a 200 OK status code if a TA added successfully to the course. | ||
|- | |- | ||
| 13 || Tests if the | | 13 || Tests if the add_ta method returns a 422 Unprocessable Entity status code if a TA cannot be added to the course. | ||
|- | |- | ||
| 14 || Tests if the | | 14 || Tests if the remove_ta method returns a 204 No Content status code if the ta is successfully removed from the course. | ||
|- | |- | ||
| 15 || Tests if | | 15 || Tests if the remove_ta method returns a 404 Not Found status code if the ta cannot be found. | ||
|- | |- | ||
| 16 || | | 16 || Tests if the set_course_fields method sets the course fields. | ||
|} | |} | ||
Revision as of 20:34, 7 April 2023
Team Contact
Team Members
- Kartik Rawool, (unityID:khrawool, GitHub:kartikrawool)
- Ameya Vaichalkar, (unityID:agvaicha, GitHub:ameyagv)
- Vikram Pande, (unityID:vspande, GitHub:vikrampande7)
Mentor
- Kartiki Bhandakkar, kbhanda3
Overview of Expertiza
Expertiza is an open-source software written using Ruby on Rails, which functions as a learning management software system. It has many different functions and abilities, including the ability to create assignments, quizzes, assignment groups, and topics, and also a complete mechanism for providing peer reviews and feedback for other groups and other teammates. Part of its functionality is a system containing information about the course and a list of operations that can be performed on the course model. The Course
model and CoursesController
, which are the classes primarily addressed in this project, are both critical components in providing this functionality.
Description of Project
course
model stores information about the instructor and institution and is associated with other models such as User, CourseParticipant, CourseTeam, Assignment, AssignmentParticipant, and Notification. The course model is responsible for completing a variety of tasks, including returning course teams, returning the submission directory for the course, viewing participants enrolled in the course, adding a participant to the course, copying the Assignment Participants to Course Participants, and checking whether a user is part of any CourseTeam. The problem description lists code smells that need to be fixed. We fixed some issues, such as deleting the unused methods and renaming methods to indicate their action. The renaming problem required us to change a few methods calls where the function to be renamed was used. Also, to reduce the cognitive complexity of the copy_assignment_participants method, we created a method to separate the raising error functionality. Comments were added to indicate the action of the methods.
The course_team
is a subclass of the team class. CourseTeams are a type of team that an instructor can use throughout an entire semester, providing consistency in team membership over time. The course_team model is responsible for completing various tasks, including returning the course of the team, adding a participant to the CourseTeam, and copying the CourseTeam Participants to AssignmentTeam Participants. There are methods for importing and exporting data to/from CSV files for CourseTeam objects. The problem description lists code smells/issues that need to be fixed. The issues that we fixed were deleting unused methods, renaming methods, and changing method calls, changing rspec expectations, adding meaningful comments. To refactor methods, DRY principles were used. In addition, analogous changes were made in the assignment_team model.
Problem Statement
Design Decisions
Implementation
Controller
Index | Method | Request Type | Description |
---|---|---|---|
1 | action_allowed | HELPER FUNCTION | Determines whether the current user has permission to perform certain actions based on their role |
2 | auto_complete_for_user_name | GET | Provides an autocomplete feature for the form input when adding a TA |
3 | new | GET | Displays the form for creating a new course |
4 | edit | GET | Method to get the course to edit |
5 | update | PUT | Method to update an existing course based on the form input and save the changes to database |
6 | copy | GET | Creates a new copy of an existing course with a new submission directory and saves it to the database |
7 | create | POST | Creates a new course based on the form input and saves it to database |
8 | delete | DELETE | Method to delete an existing course |
9 | view_teaching_assistant | GET | Displays all the teaching assistants for a course |
10 | add_ta | POST | Method to add teaching assistant to a course |
11 | remove_ta | POST | Method to remove teaching assistant from a course |
12 | set_course_fields | POST | Called in Update and Create methods to set the fields of course |
Model
Index | Method | Description |
---|---|---|
1 | get_teams | Returns any predefined teams associated with a particular course object |
2 | get_participants | Returns multiple records of course participants from database given parent_id and user_id |
3 | get_participant | Returns a single record course participant from Course Participant given parent_id |
4 | add _participant | Add a new Course Participant to the course given user_name |
5 | copy_participants | Copies all the participants from a given assignment to the current course |
6 | user_on_team | Checks whether a given user is a member of any team associated with the course |
Testing Plan
Tests
Test No. | Description |
---|---|
1 | Tests if the action_allowed disallows all actions when current user is student. |
2 | Tests if the action_allowed allows all course actions when current user is instructor. |
3 | Tests if create method returns a 201 Created status code if the resource is successfully created. |
4 | Tests if create method returns a 422 Unprocessable Entity status code if the resource cannot be created due to validation errors. |
5 | Tests if the delete method returns a 204 No Content status code if the resource is successfully deleted. |
6 | Tests if the delete method returns a 404 Not Found status code if the resource cannot be found. |
7 | Tests if the new method sets the private instance variable. |
8 | Tests if the update method returns a 200 OK status code if the resource is successfully updated. |
9 | Tests if the update method returns a 422 Unprocessable Entity status code if the resource cannot be updated due to validation errors. |
10 | Tests if the topic_name method returns the participant topic name when not nil. |
11 | Tests if the auto_complete_for_user_name method returns a list of users. |
12 | Tests if the copy method redirects to new course when new course id fetched successfully. |
13 | Tests if the view_teaching_assistants method returns list of TAs for the course. |
14 | Tests if the add_ta method returns a 200 OK status code if a TA added successfully to the course. |
13 | Tests if the add_ta method returns a 422 Unprocessable Entity status code if a TA cannot be added to the course. |
14 | Tests if the remove_ta method returns a 204 No Content status code if the ta is successfully removed from the course. |
15 | Tests if the remove_ta method returns a 404 Not Found status code if the ta cannot be found. |
16 | Tests if the set_course_fields method sets the course fields. |
Description
What it does: The Course model and CoursesController is responsible for managing the courses. This system allows admin to create a new course, edit the course and update the existing course. It also allows you to create a copy of an existing course, etc.
What needs to be done: You have to exactly follow the reimplementation guidelines as stated on top and make sure that you have covered all the functionality that is required for the Courses. You will be responsible for the entire functionality of the Courses, the model and controller, and the detailed rspec test, testing all the pass and fail scenarios, for the rest endpoints are compulsory. As mentioned in the guideline, take reference from the User (model & controller) implementation and look at roles_rspec.rb for the test, roles_rspec is not complete and there is potential for better testing but you can use that as a starting point.
Relevant Links
- Github Repository: https://github.com/ameyagv/reimplementation-back-end
- Pull Request:
- VCL Server:
Contributors to this project
- Kartik Rawool, (unityID:khrawool, GitHub:kartikrawool)
- Ameya Vaichalkar, (unityID:agvaicha, GitHub:ameyagv)
- Vikram Pande, (unityID:vspande, GitHub:vikrampande7)