CSC/ECE 517 Spring 2023 - E2339. Reimplement signed up team.rb, sign up topic.rb, sign up sheet.rb (Project 4)

From Expertiza_Wiki
Revision as of 21:44, 5 April 2023 by Sdanda (talk | contribs) (created design doc for Prog 4)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Team

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

  • Thorough RSpec tests are required for the reimplemented models.
  • Change all references of sign_up_teams to signed_up_teams.
  • Fix all code review comments.
  • There is no designated waitlist model to handle scenarios regarding waitlisting, upgrading and handling multiple registrations.
  • Some methods have readability concerns that needs to be refactored.
  • There are ambiguous class and instance methods that can be optimized for better reusability.
  • 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
delete_team TODO It is responsible for deleting the team from the table and delegating any changes in topic.
serialize_display TODO It is responsible for serializing content to JSON format.
  • Add necessary schema migrations for backward compatibility.
  • In sign_up_topic.rb, the following functionality are being implemented:-
Method Name Status Description
destroy_topic TODO It is used to destroy topic from the table.
update_topic TODO It is used to modify the attributes like description, max_choosers or category in the table.
find_team_participants TODO It is used to retrieve participants assigned to the topic.
count_filled_slots TODO It is used to return the number of slots filled for the topic.
count_available_slots TODO It is used to return the number of slots available for the topic.
release_topic TODO It is used to remove team from the topic and delegate changes to waitlist.
is_assigned_to_team TODO It is used to validate if the topic is assigned to the team
get_assigned_teams TODO It is used to retrieve teams assigned to the topic.
serialize_to_json TODO It is responsible for serializing content to JSON format.
  • In waitlist.rb, the following functionality are yet to be implemented in next phase:-
Method Name Status Description
count_waitlisted_teams TODO It is used to return the number of waitlisted teams for the particular topic.
remove_teams_from_waitlist TODO It is used to remove teams from the waitlist and return the removed teams.
add_teams_to_waitlist TODO It is used to add teams to the waitlist of the topic.
get_waitlisted_teams TODO It is used to retrieve the teams added to waitlist for the topic.

Flow Chart

Test Plan

  • Upgrade RSpec test cases for sign_up_team.rb to validate delete_team and get_participants.
  • Upgrade and add RSpec test cases for sign_up_topic.rb to find participants, handle slot availability and assignment status.
  • Create RSpec test cases for waitlist.rb to validate adding teams to waitlist, remove teams from waitlist and query status of team's waitlist.
  • Add general RSpec test cases for error handling and validate JSON serialization.