CSC/ECE 517 Spring 2022 - E2225: Refactor review mapping helper.rb

From Expertiza_Wiki
Revision as of 21:10, 21 March 2022 by Sjanard (talk | contribs)
Jump to navigation Jump to search

This wiki page is for the description of changes made under E2225 OSS assignment for Fall 2022, CSC 517.

Expertiza Background

Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.

Background

A helper method in Ruby performs certain repetitive tasks across multiple classes or a singular class, so that code is not reused and redundancy is reduced. The review_mapping_helper.rb file is primarily used to perform routine tasks with reviews. Tasks such as returning the user's name instead of the team name when there is a single person in the team, checking whether the work has been submitted within the given round and sorting the reviewers by average number of reviews in each round. Each of these functions' visibility is dependent on the type of user.

Team Members

  • Ankur Mundra (amundra@ncsu.edu)
  • Shruti Magai (smagai@ncsu.edu)
  • Sudharsan Janardhanan (sjanard@ncsu.edu)


Files modified in current project

A helper file has been modified for this project namely:

1. review_mapping_helper.rb

List of changes

We worked on the following work items(WIs)
WI1 : Refactor get_team_color method to reduce cognitive complexity
WI2 : Refactor check_submission_state to reduce cognitive complexity
WI3 : Improved assignment branch condition of method get_awarded_review_score
WI4 : Refactored review_metrics method to reduce cognitive complexity
WI5 : Added top level class documentation and corrected indectation
WI6 : Refactored method key_chart_information to include guard clause


Solutions Implemented and Delivered

  • Refactoring get_team_color method

1. This method retrieves the team's color according to the state of the review and assignment status

The initial method consisted of an if clause with multiple if-else statements nested inside.
We refactored the code and utilized the unless statement to make the code ruby friendly.

Initial code:

[[File:Example.jpg]