Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-10 15:07:55 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-10 15:07:55 +0300
commit5e11c9b77cb1b2b77ee29359047b55807afe255d (patch)
tree40b02dead6acdcaab9cc15efc9ae4710c2ed78a8 /app/models/timelog.rb
parent97d4d926630822d0e1a638206909679c962d2f0a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/timelog.rb')
-rw-r--r--app/models/timelog.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/timelog.rb b/app/models/timelog.rb
index 048134fbf04..4ddaf6bcb86 100644
--- a/app/models/timelog.rb
+++ b/app/models/timelog.rb
@@ -8,6 +8,18 @@ class Timelog < ApplicationRecord
belongs_to :merge_request, touch: true
belongs_to :user
+ scope :for_issues_in_group, -> (group) do
+ joins(:issue).where(
+ 'EXISTS (?)',
+ Project.select(1).where(namespace: group.self_and_descendants)
+ .where('issues.project_id = projects.id')
+ )
+ end
+
+ scope :between_dates, -> (start_date, end_date) do
+ where('spent_at BETWEEN ? AND ?', start_date, end_date)
+ end
+
def issuable
issue || merge_request
end