IndependentStudy Visualizations: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
'''Introduction:''' | '''Introduction:''' | ||
This project fixes the way graphs are | This project fixes the way graphs are represented in the review report. Expertiza interprets metrics in the form of a graph in the review report. This Project also refractors | ||
review_mapping_helper.rb. | review_mapping_helper.rb. | ||
'''Problem Statement:''' | '''Problem Statement:''' | ||
Currently the bars in the graphs overlap and they are not positioned properly. | Currently, the bars in the graphs overlap and they are not positioned properly. | ||
The legends (vol. and avg vol.) are present in every cell in the metrics column. | The legends (vol. and avg vol.) are present in every cell in the metrics column. | ||
The current code assumes that there are no more than three rounds. | |||
Removed charts_helpers.rb since it was not being used anywhere in the code. | Removed charts_helpers.rb since it was not being used anywhere in the code. | ||
Refractored review_mapping_helper.rb. | Refractored review_mapping_helper.rb. | ||
| Line 21: | Line 21: | ||
'''Solution:''' | '''Solution:''' | ||
1. Currently the bars in the graphs overlap and they are not positioned properly and the legends (vol. and avg vol.) are present in every cell in the metrics column. | 1. Currently, the bars in the graphs overlap and they are not positioned properly and the legends (vol. and avg vol.) are present in every cell in the metrics column. | ||
This change is present in the files - app/views/reports/_review_report.html.erb and app/helpers/review_mapping_helper.rb | This change is present in the files - app/views/reports/_review_report.html.erb and app/helpers/review_mapping_helper.rb | ||
Before: | Before: | ||
[[File:Before_Graph.jpg]] | [[File:Before_Graph.jpg]] | ||
After: | After: | ||
[[File: | [[File:After_Graph.jpg]] | ||
2. Current code assumes that there are no more than three rounds. Changes can be found in app/helpers/review_mapping_helper.rb | 2. Current code assumes that there are no more than three rounds. Changes can be found in app/helpers/review_mapping_helper.rb | ||
| Line 84: | Line 85: | ||
3. Refractored review_mapping_helper.rb. | 3. Refractored review_mapping_helper.rb. | ||
Refactored review_mapping_helper.rb. Few of the changes are reducing the length of method names, adding comments, removing redundant code, | |||
adding string interpolation. | adding string interpolation. | ||
please see the pull request for detailed code. [https://github.com/expertiza/expertiza/pull/1493] | please see the pull request for detailed code. [https://github.com/expertiza/expertiza/pull/1493] | ||
Revision as of 00:24, 4 December 2019
Introduction: This project fixes the way graphs are represented in the review report. Expertiza interprets metrics in the form of a graph in the review report. This Project also refractors review_mapping_helper.rb.
Problem Statement: Currently, the bars in the graphs overlap and they are not positioned properly. The legends (vol. and avg vol.) are present in every cell in the metrics column. The current code assumes that there are no more than three rounds. Removed charts_helpers.rb since it was not being used anywhere in the code. Refractored review_mapping_helper.rb. Add comments to methods. Files modified: app/assets/stylesheets/legend.css app/helpers/charts_helper.rb app/helpers/review_mapping_helper.rb app/views/reports/_calibration_report.html.erb app/views/reports/_feedback_report.html.erb app/views/reports/_review_report.html.erb app/views/reports/_team_score.html.erb
Solution: 1. Currently, the bars in the graphs overlap and they are not positioned properly and the legends (vol. and avg vol.) are present in every cell in the metrics column. This change is present in the files - app/views/reports/_review_report.html.erb and app/helpers/review_mapping_helper.rb
2. Current code assumes that there are no more than three rounds. Changes can be found in app/helpers/review_mapping_helper.rb
Before:
def initialize_chart_elements(reviewer)
round = 0
labels = []
reviewer_data = []
all_reviewers_data = []
if @all_reviewers_avg_vol_in_round_1 > 0
round += 1
labels.push '1st'
reviewer_data.push reviewer.avg_vol_in_round_1
all_reviewers_data.push @all_reviewers_avg_vol_in_round_1
end
if @all_reviewers_avg_vol_in_round_2 > 0
round += 1
labels.push '2nd'
reviewer_data.push reviewer.avg_vol_in_round_2
all_reviewers_data.push @all_reviewers_avg_vol_in_round_2
end
if @all_reviewers_avg_vol_in_round_3 > 0
round += 1
labels.push '3rd'
reviewer_data.push reviewer.avg_vol_in_round_3
all_reviewers_data.push @all_reviewers_avg_vol_in_round_3
end
labels.push 'Total' reviewer_data.push reviewer.overall_avg_vol all_reviewers_data.push @all_reviewers_overall_avg_vol [labels, reviewer_data, all_reviewers_data] end
After:
def initialize_chart_elements(reviewer)
#round = 0
labels = []
reviewer_data = []
all_reviewers_data = []
(1..@assignment.num_review_rounds).each do |round_num|
#round += 1
labels.push round_num.to_s
reviewer_data.push eval("reviewer.avg_vol_in_round_#{round_num}")
all_reviewers_data.push instance_variable_get("@all_reviewers_avg_vol_in_round_#{round_num}")
end
labels.push 'Total' reviewer_data.push reviewer.overall_avg_vol all_reviewers_data.push @all_reviewers_overall_avg_vol [labels, reviewer_data, all_reviewers_data] end
3. Refractored review_mapping_helper.rb. Refactored review_mapping_helper.rb. Few of the changes are reducing the length of method names, adding comments, removing redundant code, adding string interpolation.
please see the pull request for detailed code. [1]

