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

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 27: Line 27:
WI3 : Improved assignment branch condition of method get_awarded_review_score<br />
WI3 : Improved assignment branch condition of method get_awarded_review_score<br />
WI4 : Refactored review_metrics method to reduce cognitive complexity<br />
WI4 : Refactored review_metrics method to reduce cognitive complexity<br />
WI5 : Added top level class documentation and corrected indectation<br />
WI5 : Added top level class documentation and corrected indentation<br />
WI6 : Refactored method key_chart_information to include guard clause<br />




Line 72: Line 71:
[[File:Review metrics.png]]
[[File:Review metrics.png]]


5.
5. Top level documentation and corrected indentation
 
We've added top level documentation to describe the functionality of classes such as the ReviewStrategy class, StudentReviewStrategy class and TeamReviewStratregy class.<br />
Ruby style guidelines dictate that 2 spaces be used instead of tabs. We've performed these changes throughout the document.

Revision as of 22:11, 21 March 2022

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 indentation


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:

Refactored code:


2. Refactoring check_submission_state method

The initial method consisted of an if clause with multiple if-else statements nested inside.
We refactored the code and used inline if conditions to make the code more concise.

Initial code:

Refactored code:

3.

4. Refactoring review_metrics method

We utilize the unless statement to return an empty value if there is no review associated with a given team, eliminating the use of if statements in favor of ruby styled code.

Refactored code:

5. Top level documentation and corrected indentation

We've added top level documentation to describe the functionality of classes such as the ReviewStrategy class, StudentReviewStrategy class and TeamReviewStratregy class.
Ruby style guidelines dictate that 2 spaces be used instead of tabs. We've performed these changes throughout the document.