Codeminer42/cm42-central

View on GitHub
app/views/projects/reports.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title_bar do %>
  <ul class="nav navbar-nav">
    <li>
      <%= link_to @project.name, @project %>
    </li>
  </ul>
<% end %>

<% content_for :navbar do %>
  <%= render 'projects/navbar', project: @project %>
<% end %>

<div class="row">
  <div class="col-xs-12">
    <div class="page-header">
      <h4 class="page-header-title">
        <%= t('reports') %>
      </h4>
    </div>
  </div>
</div>

<div class="row">
  <div class="col-xs-12">
    <div class="panel panel-default card">
      <div class="panel-body">
        <ul class="nav nav-justified nav-pills reports-list col-xs-12">
          <li class="reports-list-item">
            <a href="#burn-up" class="nav-link"> <%= t('projects.reports.burn_up.title') %> </a>
          </li>
          <li class="reports-list-item">
            <a href="#current-iteration" class="nav-link"> <%= t('projects.reports.current_iteration.title') %></a>
          </li>
          <li class="reports-list-item">
            <a href="#velocity-by-iteration" class="nav-link"> <%= t('projects.reports.velocity_by_iteration.title') %></a>
          </li>
          <li class="reports-list-item">
            <a href="#velocity-per-member" class="nav-link"> <%= t('projects.reports.velocity_per_member.title') %></a>
          </li>
          <li class="reports-list-item">
            <a href="#bugs-impact" class="nav-link"> <%= t('projects.reports.bugs_impact.title') %></a>
          </li>
        </ul>
      </div>

      <div class="panel-footer clearfix reports-filters">
        <div class="reports-page-actions">
          <% if params[:since] %>
            <%= t("projects.reports.n months ago", count: params[:since].to_i ) %>
            <%= link_to t('projects.reports.all_time'), reports_project_path(@project), class: "btn btn-warning btn-sm navbar-btn navbar-btn-reports" %>
          <% end %>

          <% since_options.each do |qty| %>
            <% if params[:since] == qty.to_s %>
              <%= link_to t("projects.reports.n months ago", count: qty), "#", class: "btn btn-warning btn-sm navbar-btn navbar-btn-reports" %>
            <% else %>
              <%= link_to t("projects.reports.n months ago", count: qty), reports_project_path(@project, since: qty), class: "btn btn-warning btn-sm navbar-btn navbar-btn-reports" %>
            <% end %>
          <% end %>
        </div>
      </div>
    </div>
  </div>
</div>

<div class="row">
  <div class="col-xs-12">
    <div class="panel panel-default card" id="burn-up">
      <div class="panel-heading"> <%= t('projects.reports.burn_up.title') %> </div>
      <div class="panel-body">
        <% calculate_and_render_burn_up! %>

        <p><%= t('projects.reports.burn_up.backlog_points_html', count: @report_data[:total_backlog_points]) %></p>
        <p>
          <%= t('projects.reports.burn_up.remaining_time',
                velocity: @service.velocity,
                last_iteration_number: last_iteration_number,
                last_iteration_start_date: last_iteration_start_date) %>
        </p>

        <% if last_iteration_number == last_iteration_number(true) %>
          <p><%= t('projects.reports.burn_up.on_track') %></p>
        <% else %>
          <p>
            <%= t('projects.reports.burn_up.realistic_remaining_time',
                  standard_deviation: formatted_standard_deviation(@service.standard_deviation),
                  last_iteration_number: last_iteration_number(true),
                  last_iteration_start_date: last_iteration_start_date(true)) %>
          </p>
        <% end %>

        <p><%= area_chart @report_data[:group_by_day], max: @report_data[:total_backlog_points], xtitle: t('day'), ytitle: t('accepted_points') %></p>
      </div>
    </div>

    <div class="panel panel-default card" id="burn-down">
      <div class="panel-heading"> <%= t('projects.reports.burn_down.title') %> </div>
      <div class="panel-body">
        <p><%= area_chart burn_down_data, max: current_iteration_points, xtitle: t('day'), ytitle: t('delivered_points') %></p>
      </div>
    </div>
  </div>
</div>

<div class="row">
  <div class="col-xs-12 col-sm-6">
    <div class="panel panel-default card" id="current-iteration">
      <div class="panel-heading">
        <%= t('projects.reports.current_iteration.title') %>
        <small> (<%= current_iteration_start_date %> - <%= current_iteration_end_date %>) </small>
      </div>

      <div class="panel-body">
        <p>
          <%= t('projects.reports.current_iteration.planned_points',
                points_count: current_iteration_points,
                stories_count: current_iteration_count,
                non_estimable_count: current_iteration_non_estimable) %>
        </p>
        <p>
          <%= t('projects.reports.current_iteration.accepted_points',
                accepted_points: accepted_points,
                accepted_rate: accepted_rate) %>
        </p>

        <p><%= column_chart @service.current_iteration_details, xtitle: t('projects.reports.story_states'), ytitle: t('projects.reports.points') %></p>
      </div>
    </div>
  </div>

  <div class="col-xs-12 col-sm-6">
    <div class="panel panel-default card" id="velocity-by-iteration">
      <div class="panel-heading">
        <%= t('projects.reports.velocity_by_iteration.title') %>
      </div>

      <div class="panel-body">
        <ul>
          <li><%= Project.human_attribute_name(:start_date) %>: <%= @project.start_date.to_date %> (<%= t('date.day_names')[@project.iteration_start_day] %>)</li>
          <li><%= Project.human_attribute_name(:iteration_length) %>: <%= t('n weeks', count: @project.iteration_length) %></li>
          <li><%= t('velocity') %>: <%= @service.velocity %>,  <%= t('standard_deviation') %>: <%= formatted_standard_deviation(@service.standard_deviation) %>, <%= t('volatility') %>: <%= number_to_percentage(@service.volatility * 100.0, precision: 2) %></li>
        </ul>

        <p><%= column_chart @service.group_by_velocity, xtitle: t('projects.reports.iteration_number'), ytitle: t('velocity'), colors: ['green'] %></p>
      </div>
    </div>
  </div>
</div>

<div class="row">
  <div class="col-xs-12 col-sm-6">
    <div class="panel panel-default card" id="velocity-per-member">
      <div class="panel-heading">
        <%= t('projects.reports.velocity_per_member.title') %>
      </div>
      <div class="panel-body">
        <p><%= line_chart @service.group_by_developer, xtitle: t('projects.reports.iteration_number'), ytitle: t('velocity') %></p>
      </div>
    </div>
  </div>
  <div class="col-xs-12 col-sm-6">
    <div class="panel panel-default card" id="bugs-impact">
      <div class="panel-heading">
        <%= t('projects.reports.bugs_impact.title') %>
      </div>
      <div class="panel-body">
        <p><%= column_chart @service.group_by_bugs, xtitle: t('projects.reports.iteration_number'), ytitle: t('projects.reports.quantity_non_estimable'), colors: ['red'] %></p>
      </div>
    </div>
  </div>
</div>