diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-09-20 15:06:54 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-09-20 16:05:25 +0530 |
commit | 8957293d9bd0d711db3af26182205c2fe4125194 (patch) | |
tree | dcdd25393e2d6248971fddbd6c9eac30fe27ff6e /app/services/git_push_service.rb | |
parent | fa890604aaf15b9e4f0199e6a4cff24c29955a37 (diff) | |
download | gitlab-ce-8957293d9bd0d711db3af26182205c2fe4125194.tar.gz |
Implement review comments from @yorickpeterse
1. Change multiple updates to a single `update_all`
2. Use cascading deletes
3. Extract an average function for the database median.
4. Move database median to `lib/gitlab/database`
5. Use `delete_all` instead of `destroy_all`
6. Minor refactoring
Diffstat (limited to 'app/services/git_push_service.rb')
-rw-r--r-- | app/services/git_push_service.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index cde993221ff..c499427605a 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -190,6 +190,8 @@ class GitPushService < BaseService def update_issue_metrics(commit, authors) mentioned_issues = commit.all_references(authors[commit]).issues - mentioned_issues.each { |issue| issue.metrics.record_commit_mention!(commit.committed_date) if issue.metrics.present? } + + Issue::Metrics.where(issue_id: mentioned_issues.map(&:id), first_mentioned_in_commit_at: nil). + update_all(first_mentioned_in_commit_at: commit.committed_date) end end |