Sha256: c3aa81f4de4cc2a63938c380c01d34bba674ff369863848ff2b266a78b69046b
Contents?: true
Size: 686 Bytes
Versions: 7
Compression:
Stored size: 686 Bytes
Contents
# encoding: UTF-8 module ReportDaily extend ActiveSupport::Concern included do include Report end def start_datetime DateTime.new(report_date.year, report_date.month, report_date.day, 0, 0, 0) end def end_datetime DateTime.new(report_date.year, report_date.month, report_date.day, 23, 59, 59) end def previous_report self.class.where(report_date: report_date - 1.day).first end module ClassMethods def update_report_for(date) report = self.find_or_create_by(report_date: date) report.update_report!() return report end def update_report_for_today() return self.update_report_for(Date.today) end end end
Version data entries
7 entries across 7 versions & 1 rubygems