CSC/ECE 517 Spring 2020 - Project E2008. Refactor summary helper.rb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 101: Line 101:
This method could be refactored into smaller methods namely ''summarize_reviews_by_reviewee'' and ''summarize_reviews_by_reviewee_assign'' where ''summarize_reviews_by_reviewee'' calls ''summarize_reviews_by_reviewee_assign'' to get average scores and summary for each question.
This method could be refactored into smaller methods namely ''summarize_reviews_by_reviewee'' and ''summarize_reviews_by_reviewee_assign'' where ''summarize_reviews_by_reviewee'' calls ''summarize_reviews_by_reviewee_assign'' to get average scores and summary for each question.


[[File:e2008_1.jpg]]
[[File:e2008_1.jpg|50px]]
[[File:e2008_2.jpg]]
[[File:e2008_2.jpg]]



Revision as of 17:25, 21 March 2020

This page provides a description of the Expertiza based OSS project.


About Expertiza

Expertiza is a web application developed using Ruby on Rails Framework whose creation and maintenance are taken care of by students as well as the faculty of NCSU. Its code is available on Github Expertiza on GitHub. Expertiza allows the instructor to create and edit new as well as existing assignments. This also includes creating a wide range of topics under each assignment that students can sign up for. They can also publish surveys and reviews, view statistical results, set deadlines for assignments and make announcements. It provides a platform for students to signup for topics, form teams, view and submit assignments and give peer reviews and feedback.

Problem Statement

Background: In Expertiza students can review each other’s projects and even each other as teammates. Students can view their project scores and instructors can view student's teammate review scores on the view scores page. This helper file aids in calculating these scores and rendering the results on the view scores section of an assignment. Summary helper is a helper module that consists of methods used to calculate scores for these reviews. This is for the use of instructors.

Requirement: E2008 is an Expertiza OSS project which deals basically with refactoring app/helpers/summary_helper.rb to reduce the code climate issues such as

Issues found

The following are issues which were found in the code:

  • Assignment Branch Condition
Method ABC Size
summarize_reviews_by_reviewee 44.61
summarize_reviews_by_criterion 42.34
summarize_reviews_by_reviewees 89.93
get_questions_by_assignment 16.43
calculate_avg_score_by_round 18.57


  • Cognitive Complexity
Method Cognitive Complexity
summarize_reviews_by_criterion 16
summarize_reviews_by_reviewees 17
get_questions_by_assignment 11
break_up_comments_to_sentences 6


  • Method/line too long
Method/Line too long Comments
Method: summarize_reviews_by_reviewees Lines of Code:39
Method: summarize_reviews_by_criterion Lines of Code:27
Line: 145 self.avg_scores_by_round[reviewee.name][round] too long (162/160)
  • Unused variables / access modifiers:
Vaiable/Access Modifier Comments
Variable: summary Method: summarize_sentences
Variable: included_question_counter Method: summarize_reviews_by_reviewee
Access Modifier: module_function Class: Summary

Solution Implemented

  • Refactor summarize_reviews_by_reviewee:

This method is used to summarize reviews by a reviewer for each question.

Changes Made: This method could be refactored into smaller methods namely summarize_reviews_by_reviewee and summarize_reviews_by_reviewee_assign where summarize_reviews_by_reviewee calls summarize_reviews_by_reviewee_assign to get average scores and summary for each question.

  • Refactor summarize_reviews_by_criterion:

This method is used to summarize the review for each questions

Changes Made: This method was refactored into 3 smaller methods namely summarize_reviews_by_criterion, summarize_reviews_by_criterion_questions and end_threads.

The method summarize_reviews_by_criterion calls summarize_reviews_by_criterion_questions to get answers of each question in the rubric.

The method summarize_reviews_by_criterion_questions starts many threads to process each question and closes it by calling the function end_threads.

  • Refactor summarize_reviews_by_reviewees:

This method is used to produce summaries for instructor and students. It sums up the feedback by criterion for each reviewee

Changes Made: This method was refactored into 3 smaller methods namely summarize_reviews_by_reviewees, summarize_by_rounds and end_threads.

The method summarize_reviews_by_reviewees calls summarize_by_rounds to get answers of each reviewer by rubric.

The method summarize_by_rounds starts many threads to create requests to summarize the comments and closes the threads by calling the function end_threads.

Future improvement

Contributors