Provide stage legend on server response

This commit is contained in:
Alfredo Sumaran 2016-11-16 13:57:32 -05:00
parent ee6b991f0b
commit 06fd2879ee
2 changed files with 10 additions and 9 deletions

View file

@ -29,15 +29,15 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
def generate_cycle_analytics_data
stats_values = []
cycle_analytics_view_data = [[:issue, "Issue", "Time before an issue gets scheduled"],
[:plan, "Plan", "Time before an issue starts implementation"],
[:code, "Code", "Time until first merge request"],
[:test, "Test", "Total test time for all commits/merges"],
[:review, "Review", "Time between merge request creation and merge/close"],
[:staging, "Staging", "From merge request merge until deploy to production"],
[:production, "Production", "From issue creation until deploy to production"]]
cycle_analytics_view_data = [[:issue, "Issue", "Related Issues", "Time before an issue gets scheduled"],
[:plan, "Plan", "Related Commits", "Time before an issue starts implementation"],
[:code, "Code", "Related Merge Requests", "Time until first merge request"],
[:test, "Test", "Relative Builds Trigger by Commits", "Total test time for all commits/merges"],
[:review, "Review", "Relative Merged Requests", "Time between merge request creation and merge/close"],
[:staging, "Staging", "Relative Deployed Builds", "From merge request merge until deploy to production"],
[:production, "Production", "Related Issues", "From issue creation until deploy to production"]]
stats = cycle_analytics_view_data.reduce([]) do |stats, (stage_method, stage_text, stage_description)|
stats = cycle_analytics_view_data.reduce([]) do |stats, (stage_method, stage_text, stage_legend, stage_description)|
value = @cycle_analytics.send(stage_method).presence
stats_values << value.abs if value
@ -45,6 +45,7 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
stats << {
title: stage_text,
description: stage_description,
legend: stage_legend,
value: value && !value.zero? ? distance_of_time_in_words(value) : nil
}

View file

@ -60,7 +60,7 @@
%i.has-tooltip.fa.fa-question-circle{ "data-placement" => "top", title: "The value lying at the midpoint of a series of observed values. E.g., between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 = 6.", "aria-hidden" => "true" }
%li.event-header
%span.stage-name
{{ currentStage ? currentStage.legendTitle : 'Related Issues' }}
{{ currentStage ? currentStage.legend : 'Related Issues' }}
%i.has-tooltip.fa.fa-question-circle{ "data-placement" => "top", title: "The collection of events added to the data gathered for that stage.", "aria-hidden" => "true" }
%li.total-time-header
%span.stage-name