IndependentStudy Visualizations: Difference between revisions
No edit summary |
No edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
===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=== | |||
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. | |||
* Refactored review_mapping_helper.rb. | |||
* Add comments to methods. | |||
Add comments to methods. | |||
===Files modified=== | |||
Files modified | |||
app/assets/stylesheets/legend.css | app/assets/stylesheets/legend.css | ||
app/helpers/charts_helper.rb | app/helpers/charts_helper.rb | ||
| Line 20: | Line 20: | ||
app/views/reports/_team_score.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. | 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''' | ||
<br> | |||
[[File:Before_Graph.jpg]] | [[File:Before_Graph.jpg]] | ||
<br><br> | |||
2. | '''After''' | ||
<br> | |||
[[File:After_Graph.jpg]] | |||
<br><br> | |||
2. The current code assumes that there are no more than three rounds. Changes can be found in app/helpers/review_mapping_helper.rb | |||
Before | '''Before''' | ||
def initialize_chart_elements(reviewer) | def initialize_chart_elements(reviewer) | ||
round = 0 | round = 0 | ||
| Line 55: | Line 59: | ||
all_reviewers_data.push @all_reviewers_avg_vol_in_round_3 | all_reviewers_data.push @all_reviewers_avg_vol_in_round_3 | ||
end | end | ||
labels.push 'Total' | labels.push 'Total' | ||
reviewer_data.push reviewer.overall_avg_vol | reviewer_data.push reviewer.overall_avg_vol | ||
| Line 62: | Line 65: | ||
end | end | ||
After | '''After''' | ||
def initialize_chart_elements(reviewer) | def initialize_chart_elements(reviewer) | ||
| Line 76: | Line 79: | ||
all_reviewers_data.push instance_variable_get("@all_reviewers_avg_vol_in_round_#{round_num}") | all_reviewers_data.push instance_variable_get("@all_reviewers_avg_vol_in_round_#{round_num}") | ||
end | end | ||
labels.push 'Total' | labels.push 'Total' | ||
reviewer_data.push reviewer.overall_avg_vol | reviewer_data.push reviewer.overall_avg_vol | ||
| Line 84: | Line 86: | ||
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] | ||
Latest revision as of 00:38, 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.
- Refactored 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
After
2. The 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]
