Commit 58dddcdf authored by James Lopez's avatar James Lopez

few fixes after merge

parent 69ecd951
......@@ -7,7 +7,9 @@ class CycleAnalytics
end
def summary
@summary ||= ::Gitlab::CycleAnalytics::StageSummary.new(@project, from: @options[:from]).data
@summary ||= ::Gitlab::CycleAnalytics::StageSummary.new(@project,
from: @options[:from],
current_user: @options[:current_user]).data
end
def stats
......
module Gitlab
module CycleAnalytics
class StageSummary
def initialize(project, from:)
def initialize(project, from:, current_user:)
@project = project
@from = from
@current_user = current_user
end
def data
[serialize(Summary::Issue.new(project: @project, from: @from)),
[serialize(Summary::Issue.new(project: @project, from: @from, current_user: @current_user)),
serialize(Summary::Commit.new(project: @project, from: @from)),
serialize(Summary::Deploy.new(project: @project, from: @from))]
end
......
......@@ -2,12 +2,18 @@ module Gitlab
module CycleAnalytics
module Summary
class Issue < Base
def initialize(project:, from:, current_user:)
@project = project
@from = from
@current_user = current_user
end
def title
'New Issue'
end
def value
@value ||= @project.issues.created_after(@from).count
@value ||= IssuesFinder.new(@current_user, project_id: @project.id).execute.created_after(@from).count
end
end
end
......
......@@ -2,9 +2,9 @@ require 'spec_helper'
describe Gitlab::CycleAnalytics::StageSummary, models: true do
let(:project) { create(:project) }
let(:from) { Time.now }
let(:from) { 1.day.ago }
let(:user) { create(:user, :admin) }
subject { described_class.new(project, from: Time.now).data }
subject { described_class.new(project, from: Time.now, current_user: user).data }
describe "#new_issues" do
it "finds the number of issues created after the 'from date'" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment