diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-09-19 15:00:55 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-09-19 15:00:55 +0530 |
commit | 4531e433ad33e67cb66abaa4626b5e608eb11f11 (patch) | |
tree | e2199500817186477599b226f32d5acb778a2cc0 /app/models/cycle_analytics | |
parent | 2cddd02ec5dd9d27fc9e9b6ac5e0748fe92e1cff (diff) | |
download | gitlab-ce-4531e433ad33e67cb66abaa4626b5e608eb11f11.tar.gz |
Make changes to the cycle analytics JSON endpoint.
1. Add `summary` section.
2. `stats` is `null` if no stats are present.
3. `stats` and `summary` are both arrays.
Diffstat (limited to 'app/models/cycle_analytics')
-rw-r--r-- | app/models/cycle_analytics/summary.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/models/cycle_analytics/summary.rb b/app/models/cycle_analytics/summary.rb new file mode 100644 index 00000000000..2fa94f8c18c --- /dev/null +++ b/app/models/cycle_analytics/summary.rb @@ -0,0 +1,21 @@ +class CycleAnalytics + class Summary + def initialize(project, from:) + @project = project + @from = from + end + + def new_issues + @project.issues.where("created_at > ?", @from).count + end + + def commits + repository = @project.repository.raw_repository + repository.log(ref: @project.default_branch, after: @from).count + end + + def deploys + @project.deployments.count + end + end +end |