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

has_timelogs_report.rb « concerns « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3af063438bf571b03b73dc8993810fe646f612bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module HasTimelogsReport
  extend ActiveSupport::Concern
  include Gitlab::Utils::StrongMemoize

  def timelogs(start_time, end_time)
    strong_memoize(:timelogs) { timelogs_for(start_time, end_time) }
  end

  def user_can_access_group_timelogs?(current_user)
    Ability.allowed?(current_user, :read_group_timelogs, self)
  end

  private

  def timelogs_for(start_time, end_time)
    Timelog.between_times(start_time, end_time).in_group(self)
  end
end