Skip to content

Commit

Permalink
Refactoring methods name
Browse files Browse the repository at this point in the history
  • Loading branch information
alaxalves committed Dec 13, 2017
1 parent 0d3d836 commit 11e11cd
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions app/helpers/metric_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def get_metrics(grade)

def calculate_metrics(release)
sprint = release.sprints.last

if sprint.blank? || sprint.stories.blank?
return nil
else
Expand Down Expand Up @@ -53,19 +54,19 @@ def calculate_metrics(release)
set_ideal_line(days_of_sprint, ideal_line, total_points)
ideal_burned_points = ideal_line[0] - ideal_line[1]

for i in 0..(date_axis.length - 2)
real_burned_points = points_axis[i] - points_axis[i + 1]
for date in 0..(date_axis.length - 2)
real_burned_points = points_axis[date] - points_axis[date + 1]
burned_percentage = Float((real_burned_points).abs * 100) / ideal_burned_points
metric_burndown_array.push(burned_percentage)
end

for i in 0..(amount_of_sprints - 1)
metric_velocity_value += (total_sprints_points[i] - velocities[i])
for sprint_amount in 0..(amount_of_sprints - 1)
metric_velocity_value += (total_sprints_points[sprint_amount] - velocities[sprint_amount])
end

for i in 0..(release.sprints.length - 1)
planned_points += velocity[:total_points][i]
burned_points += velocity[:completed_points][i]
for release_amount in 0..(release.sprints.length - 1)
planned_points += velocity[:total_points][release_amount]
burned_points += velocity[:completed_points][release_amount]
end

metric_burndown_value = calculate_burndown(metric_burndown_array)
Expand Down Expand Up @@ -102,19 +103,19 @@ def calculate_velocity_and_debt(metric)
return values
end

def calculate_burndown(metric)
def calculate_burndown(metrics)
values = 0

for i in 0..(metric.length - 1)
if metric[i] <= 10 || metric[i] >= 200
for metric in 0..(metrics.length - 1)
if metrics[metric] <= 10 || metrics[metric] >= 200
values += 0
elsif metric[i] <= 40
elsif metrics[metric] <= 40
values += 1
elsif metric[i] <= 60
elsif metrics[metric] <= 60
values += 2
elsif metric[i] <= 80
elsif metrics[metric] <= 80
values += 3
elsif metric[i] <= 100
elsif metrics[metric] <= 100
values += 4
end
end
Expand Down

0 comments on commit 11e11cd

Please sign in to comment.