CSC/ECE 517 Spring 2023 - E2301. Refactor review maping helper: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
==Introduction== | |||
This page gives a description of the changes made for the review_mapping_helper.rb of Expertiza based OSS project. | This page gives a description of the changes made for the review_mapping_helper.rb of Expertiza based OSS project. | ||
==Overview of Expertiza== | |||
Expertiza is a learning management system that is available as open source software and was created using Ruby on Rails. It has a wide range of features and capabilities, where students can submit and peer-review learning objects (articles, codes, websites, etc). Instructors add and grade the assignments submitted by students to Expertiza. The files that are largely addressed in this project, such as assignment_node.rb, course_node.rb, team_node.rb, folder_node.rb, and questionnaire_node.rb, are essential in executing this functionality. It is supported by the National Science Foundation. | Expertiza is a learning management system that is available as open source software and was created using Ruby on Rails. It has a wide range of features and capabilities, where students can submit and peer-review learning objects (articles, codes, websites, etc). Instructors add and grade the assignments submitted by students to Expertiza. The files that are largely addressed in this project, such as assignment_node.rb, course_node.rb, team_node.rb, folder_node.rb, and questionnaire_node.rb, are essential in executing this functionality. It is supported by the National Science Foundation. | ||
==Problem Statement== | |||
The review_mapping_helper.rb has multiple functions with a high complexities namely - Cognitive, Perceived, Cyclomatic, Assignment Branch Condition size (ABC size) and Lines of Code (LOC). The review_mapping_helper.rb has methods which exceeds the limit on lines of code. It is missing proper comments for each functionality. | The review_mapping_helper.rb has multiple functions with a high complexities namely - Cognitive, Perceived, Cyclomatic, Assignment Branch Condition size (ABC size) and Lines of Code (LOC). The review_mapping_helper.rb has methods which exceeds the limit on lines of code. It is missing proper comments for each functionality. | ||
==Changes Made== | |||
1) Reduced lines of code by removing unnecessary line breaks | '''1) Reduced lines of code by removing unnecessary line breaks''' | ||
== | Before | ||
def display_volume_metric_chart(reviewer) | |||
labels, reviewer_data, all_reviewers_data = initialize_chart_elements(reviewer) | |||
data = { | |||
labels: labels, | |||
datasets: [ | |||
{ | |||
label: 'vol.', | |||
backgroundColor: 'rgba(255,99,132,0.8)', | |||
borderWidth: 1, | |||
data: reviewer_data, | |||
yAxisID: 'bar-y-axis1' | |||
}, | |||
{ | |||
label: 'avg. vol.', | |||
backgroundColor: 'rgba(255,206,86,0.8)', | |||
borderWidth: 1, | |||
data: all_reviewers_data, | |||
yAxisID: 'bar-y-axis2' | |||
} | |||
] | |||
} | |||
options = { | |||
legend: { | |||
position: 'top', | |||
labels: { | |||
usePointStyle: true | |||
} | |||
}, | |||
width: '200', | |||
height: '125', | |||
scales: { | |||
yAxes: [{ | |||
stacked: true, | |||
id: 'bar-y-axis1', | |||
barThickness: 10 | |||
}, { | |||
display: false, | |||
stacked: true, | |||
id: 'bar-y-axis2', | |||
barThickness: 15, | |||
type: 'category', | |||
categoryPercentage: 0.8, | |||
barPercentage: 0.9, | |||
gridLines: { | |||
offsetGridLines: true | |||
} | |||
}], | |||
xAxes: [{ | |||
stacked: false, | |||
ticks: { | |||
beginAtZero: true, | |||
stepSize: 50, | |||
max: 400 | |||
} | |||
}] | |||
} | |||
} | |||
horizontal_bar_chart data, options | |||
end | |||
After | |||
def display_volume_metric_chart(reviewer) | |||
labels, reviewer_data, all_reviewers_data = initialize_chart_elements(reviewer) | |||
data = { | |||
labels: labels, | |||
datasets: [ | |||
{ | |||
label: 'vol.', | |||
backgroundColor: 'rgba(255,99,132,0.8)', | |||
borderWidth: 1, | |||
data: reviewer_data, | |||
yAxisID: 'bar-y-axis1' | |||
}, | |||
{ | |||
label: 'avg. vol.', | |||
backgroundColor: 'rgba(255,206,86,0.8)', | |||
borderWidth: 1, | |||
data: all_reviewers_data, | |||
yAxisID: 'bar-y-axis2' | |||
} | |||
] | |||
} | |||
options = { | |||
legend: { position: 'top', labels: { usePointStyle: true } }, | |||
width: '200', height: '125', | |||
scales: { | |||
yAxes: [ | |||
{ stacked: true, id: 'bar-y-axis1', barThickness: 10 }, | |||
{ | |||
display: false, stacked: true, id: 'bar-y-axis2', | |||
barThickness: 15, type: 'category', | |||
categoryPercentage: 0.8, barPercentage: 0.9, | |||
gridLines: { offsetGridLines: true } | |||
} | |||
], | |||
xAxes: [ | |||
{ stacked: false, ticks: { beginAtZero: true, stepSize: 50, max: 400 } } | |||
] | |||
} | |||
} | |||
horizontal_bar_chart(data, options) | |||
end |
Revision as of 22:37, 22 March 2023
Introduction
This page gives a description of the changes made for the review_mapping_helper.rb of Expertiza based OSS project.
Overview of Expertiza
Expertiza is a learning management system that is available as open source software and was created using Ruby on Rails. It has a wide range of features and capabilities, where students can submit and peer-review learning objects (articles, codes, websites, etc). Instructors add and grade the assignments submitted by students to Expertiza. The files that are largely addressed in this project, such as assignment_node.rb, course_node.rb, team_node.rb, folder_node.rb, and questionnaire_node.rb, are essential in executing this functionality. It is supported by the National Science Foundation.
Problem Statement
The review_mapping_helper.rb has multiple functions with a high complexities namely - Cognitive, Perceived, Cyclomatic, Assignment Branch Condition size (ABC size) and Lines of Code (LOC). The review_mapping_helper.rb has methods which exceeds the limit on lines of code. It is missing proper comments for each functionality.
Changes Made
1) Reduced lines of code by removing unnecessary line breaks
Before
def display_volume_metric_chart(reviewer)
labels, reviewer_data, all_reviewers_data = initialize_chart_elements(reviewer) data = { labels: labels, datasets: [ { label: 'vol.', backgroundColor: 'rgba(255,99,132,0.8)', borderWidth: 1, data: reviewer_data, yAxisID: 'bar-y-axis1' }, { label: 'avg. vol.', backgroundColor: 'rgba(255,206,86,0.8)', borderWidth: 1, data: all_reviewers_data, yAxisID: 'bar-y-axis2' } ] } options = { legend: { position: 'top', labels: { usePointStyle: true } }, width: '200', height: '125', scales: { yAxes: [{ stacked: true, id: 'bar-y-axis1', barThickness: 10 }, { display: false, stacked: true, id: 'bar-y-axis2', barThickness: 15, type: 'category', categoryPercentage: 0.8, barPercentage: 0.9, gridLines: { offsetGridLines: true } }], xAxes: [{ stacked: false, ticks: { beginAtZero: true, stepSize: 50, max: 400 } }] } } horizontal_bar_chart data, options end
After
def display_volume_metric_chart(reviewer)
labels, reviewer_data, all_reviewers_data = initialize_chart_elements(reviewer) data = { labels: labels, datasets: [ { label: 'vol.', backgroundColor: 'rgba(255,99,132,0.8)', borderWidth: 1, data: reviewer_data, yAxisID: 'bar-y-axis1' }, { label: 'avg. vol.', backgroundColor: 'rgba(255,206,86,0.8)', borderWidth: 1, data: all_reviewers_data, yAxisID: 'bar-y-axis2' } ] } options = { legend: { position: 'top', labels: { usePointStyle: true } }, width: '200', height: '125', scales: { yAxes: [ { stacked: true, id: 'bar-y-axis1', barThickness: 10 }, { display: false, stacked: true, id: 'bar-y-axis2', barThickness: 15, type: 'category', categoryPercentage: 0.8, barPercentage: 0.9, gridLines: { offsetGridLines: true } } ], xAxes: [ { stacked: false, ticks: { beginAtZero: true, stepSize: 50, max: 400 } } ] } } horizontal_bar_chart(data, options) end