summaryrefslogtreecommitdiff
path: root/app/models/cycle_analytics
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-09-20 09:54:42 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-09-20 13:23:14 +0530
commit204419e9e9b01977cbeac34b1a8385239b1455aa (patch)
treeffd299a69a4616501902d0be198d4c4aa0077f7e /app/models/cycle_analytics
parent461b399538b275bf6b7b477c2f3dbd38718140c5 (diff)
downloadgitlab-ce-204419e9e9b01977cbeac34b1a8385239b1455aa.tar.gz
Test the `CycleAnalytics::Summary` model.
Diffstat (limited to 'app/models/cycle_analytics')
-rw-r--r--app/models/cycle_analytics/summary.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/models/cycle_analytics/summary.rb b/app/models/cycle_analytics/summary.rb
index 2fa94f8c18c..04a90a8da49 100644
--- a/app/models/cycle_analytics/summary.rb
+++ b/app/models/cycle_analytics/summary.rb
@@ -11,11 +11,14 @@ class CycleAnalytics
def commits
repository = @project.repository.raw_repository
- repository.log(ref: @project.default_branch, after: @from).count
+
+ if @project.default_branch
+ repository.log(ref: @project.default_branch, after: @from).count
+ end
end
def deploys
- @project.deployments.count
+ @project.deployments.where("created_at > ?", @from).count
end
end
end