CSC/ECE 517 Spring 2023 - E2315. Reimplement signed up team.rb, sign up topic.rb, sign up sheet.rb
Background
Expertiza is a n 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. It includes functionality to assign a project topic for each team. If it is not available, then it waitlists the team in case if the topic is available. The sign_up_team.rb, sign_up_topic.rb and sign_up_sheet.rb are the model classes in this project to provide this functionality.
Team
- Mentor - Krishna Saurabh Vankadaru
- Sai Venkata Varun Danda
- Saketh Vangala
- Surya Prakash Susarla
- Pull Request - https://github.com/expertiza/reimplementation-back-end/pull/19
- Project Board - https://github.com/users/SakethVangala11/projects/1/views/1
Project Description
The objective of the project is to reimplement the following Ruby on Rails model classes in the existing project:- SignUpTeam, SignUpTopic and SignUpSheet. SignUpTeam model class represents a signed-up team for a particular sign-up topic in a specific assignment. SignUpTopic model class represents a topic that can be signed up for in a course assignment. SignUpSheet class stores the logic for creating a signed_up_team for a topic for a particular assignment. This class is being used as a module having all class methods.
The task is to reimplement the existing code present in these model files and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation.
Issue Description
- The SignedUpTeam class has methods that handle multiple responsibilities, including finding participants and teams, releasing topics, and removing signed up teams. This violates the single responsibility principle and makes the class harder to understand and maintain.
- Some of the queries in the class use complex SQL statements and multiple joins, which can make them hard to read and understand. These complex SQL queries in the code could be simplified and made more readable by using ActiveRecord's query interface instead.
- The same code is repeated in multiple methods, such as the code to find signed up teams for a given topic. This violates the Don't Repeat Yourself (DRY) principle and can make the code harder to maintain.
Design Strategy
- To tackle the mentioned problem, three model class files namely sign_up_team.rb, sign_up_topic.rb and waitlist.rb are implemented.
- sign_up_sheet.rb is removed because the class methods can be refactored into sign_up_topic.rb and waitlist.rb.
- In sign_up_team.rb, the following functionality are being implemented:-
Method Name | Status | Description |
---|---|---|
create_sign_up_team | Implemented | It is responsible for creating a new sign up team in the table. |
delete_sign_up_team | Implemented | It is responsible for deleting a sign up team from the table. |
find_team_participants | Implemented | It is used to get participants in the team signed up for the given topic. |
update_sign_up_team | TODO | It is responsible for adding/removing a team member from the sign up team and updating the changes in the table. |
release_topics | TODO | It is used to update the waitlist and release topics. |
- In sign_up_topic.rb, the following functionality are being implemented:-
Method Name | Status | Description |
---|---|---|
create_topic | Implemented | It is used to create a new topic in the table. |
update_topic | Implemented | It is used to modify the attributes like description, max_choosers or category in the table. |
delete_topic | Implemented | It is used to remove the sign up topic from the table. |
format_for_display | Implemented | It is used to return the formatted topic name. |
find_if_topic_available? | Implemented | It is used to fetch available topic for further selection. A topic is considered available if the total number of teams assigned to the topic are less than the maximum choosers allowed. |
update_waitlisted_users | TODO | It is used to send update to all waitlisted users regarding waitlist changes. |
- In waitlist.rb, the following functionality are yet to be implemented in next phase:-
Method Name | Status | Description |
---|---|---|
add_team_to_waitlist | TODO | It is used to add a sign up team to the topic’s waitlist. |
assign_topic_to_team | TODO | It is used to assign the topic to a team in the waitlist. |
remove_team_waitlist | TODO | It is used to remove a sign up team from the topic’s waitlist. |
destroy_waitlist | TODO | It is used to remove all the sign up teams from the topic’s waitlist. |
Flow Chart
Test Plan
We have implemented test cases using RSpec for different validation checks for both sign_up_team.rb and sign_up_topic.rb. The other test cases include 'create' tests that validate whether the utility methods can create the records in the table as expected. Moreover, 'update' test cases are included to validate whether the modifications are updated in the table. Finally, we perform 'destroy' tests to validate whether the record is deleted from the table. We also added unit tests that validate other instance methods, such as format_for_display, in both SignUpTeam and SignUpTopic model classes. We created helper stubs for the new methods yet to be implemented to perform the testing process smoothly. We have attached the unit test assessment video as shown here https://vimeo.com/810685088
Future Plan
The future scope of this project is to implement waitlist.rb model class that handles the functions related to adding/removing sign up teams to the waitlist for each topic. There are other instance methods in both sign_up_team.rb and sign_up_topic.rb that requires implementation. But, since they are dependent on other model classes, we have added them to our TODO list to implement them in the future.