2018-12-13 14:26:56 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-28 09:17:42 -04:00
|
|
|
class ProjectDailyStatistic < ApplicationRecord
|
2018-12-13 14:26:56 -05:00
|
|
|
belongs_to :project
|
|
|
|
|
|
|
|
scope :of_project, -> (project) { where(project: project) }
|
|
|
|
scope :of_last_30_days, -> { where('date >= ?', 29.days.ago.utc.to_date) }
|
|
|
|
scope :sorted_by_date_desc, -> { order(project_id: :desc, date: :desc) }
|
|
|
|
scope :sum_fetch_count, -> { sum(:fetch_count) }
|
|
|
|
end
|