diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-07-05 14:41:02 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-07-05 14:41:02 +0300 |
commit | 4b74c55b1572da19d78fa6982edf54916d09eec3 (patch) | |
tree | 8acbf6788fca6b8f7f31f51c43ad9556dc74e09b /app/controllers/projects_controller.rb | |
parent | 22005da2377275e3a80d37bfa689e474869b645a (diff) | |
download | gitlab-ci-4b74c55b1572da19d78fa6982edf54916d09eec3.tar.gz |
More charts. Correct routes to actual page names
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r-- | app/controllers/projects_controller.rb | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 17b2759..e35cd34 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,6 +1,6 @@ class ProjectsController < ApplicationController before_filter :authenticate_user!, except: [:build, :status, :index, :show] - before_filter :project, only: [:build, :details, :show, :status, :edit, :update, :destroy, :stats] + before_filter :project, only: [:build, :integration, :show, :status, :edit, :update, :destroy, :charts] before_filter :authenticate_token!, only: [:build] before_filter :no_cache, only: [:status] @@ -25,7 +25,7 @@ class ProjectsController < ApplicationController @builds = @builds.order('id DESC').page(params[:page]).per(20) end - def details + def integration end def create @@ -102,27 +102,11 @@ class ProjectsController < ApplicationController send_file Rails.root.join('public', image_name), filename: image_name, disposition: 'inline' end - def stats - first_build, last_build = @project.builds.first, @project.builds.last - - labels = [] - total = [] - success = [] - - 13.times do |i| - start_month = (Date.today.years_ago(1) + i.month).beginning_of_month - end_month = start_month.end_of_month - - labels << start_month.strftime("%d %B %Y") - total << @project.builds.where("? > created_at AND created_at > ?", end_month, start_month).count - success << @project.builds.where("? > created_at AND created_at > ?", end_month, start_month).success.count - end - - @stats = { - labels: labels, - total: total, - success: success - } + def charts + @charts = {} + @charts[:week] = Charts::WeekChart.new(@project) + @charts[:month] = Charts::MonthChart.new(@project) + @charts[:year] = Charts::YearChart.new(@project) end def gitlab |