diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-23 16:40:55 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-23 16:40:55 +0000 |
commit | e24da35984c13132e204ff923e4b75600ebed56e (patch) | |
tree | 73c373598b5b5a97df452adcaa6496b3aed223a0 /app/models/project_contributions.rb | |
parent | 3ca34bb8f0fa4fa3a40e9ccc44cd5d8784f30c7d (diff) | |
parent | b449bc5b77aa658db67ebcb25f709fe51c29b129 (diff) | |
download | gitlab-ce-e24da35984c13132e204ff923e4b75600ebed56e.tar.gz |
Merge branch 'improve-contributions-calendar' into 'master'
Replace commits calendar with contributions calendar
* count opening of issues and merge requests
* dont trigger git repository - use events from database
* count pushes instead of commits for faster and easier counting
* much-much faster since does not affected by repository size
See merge request !420
Diffstat (limited to 'app/models/project_contributions.rb')
-rw-r--r-- | app/models/project_contributions.rb | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/app/models/project_contributions.rb b/app/models/project_contributions.rb deleted file mode 100644 index bfe9928b158..00000000000 --- a/app/models/project_contributions.rb +++ /dev/null @@ -1,32 +0,0 @@ -class ProjectContributions - attr_reader :project, :user - - def initialize(project, user) - @project, @user = project, user - end - - def commits_log - repository = project.repository - - if !repository.exists? || repository.empty? - return {} - end - - Rails.cache.fetch(cache_key) do - repository.commits_per_day_for_user(user) - end - end - - def user_commits_on_date(date) - repository = @project.repository - - if !repository.exists? || repository.empty? - return [] - end - commits = repository.commits_by_user_on_date_log(@user, date) - end - - def cache_key - "#{Date.today.to_s}-commits-log-#{project.id}-#{user.email}" - end -end |