Updated code based on feedback

This commit is contained in:
James Lopez 2016-11-21 17:29:07 +01:00
parent 7a63021ab3
commit a3331eee91
2 changed files with 3 additions and 7 deletions

View file

@ -10,7 +10,7 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
stats_values, cycle_analytics_json = generate_cycle_analytics_data
@cycle_analytics_not_set_up = stats_with_no_data?(stats_values)
@cycle_analytics_no_data = stats_values.blank?
respond_to do |format|
format.html
@ -68,8 +68,4 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
[stats_values, cycle_analytics_hash]
end
def stats_with_no_data?(stats_values)
stats_values.blank? || stats_values.inject(:+).zero?
end
end

View file

@ -17,7 +17,7 @@ describe Projects::CycleAnalyticsController do
project_id: project.to_param)
expect(response).to be_success
expect(assigns(:cycle_analytics_not_set_up)).to eq(true)
expect(assigns(:cycle_analytics_no_data)).to eq(true)
end
end
@ -36,7 +36,7 @@ describe Projects::CycleAnalyticsController do
project_id: project.to_param)
expect(response).to be_success
expect(assigns(:cycle_analytics_not_set_up)).to eq(false)
expect(assigns(:cycle_analytics_no_data)).to eq(false)
end
end
end