Sha256: 2ee05e9f3f1bcd0b367904182158ccc4528794c7db47681b935306e603fcf42f
Contents?: true
Size: 1.2 KB
Versions: 81
Compression:
Stored size: 1.2 KB
Contents
class Avo::Cards::<%= class_name.camelize %> < Avo::Cards::MetricCard self.id = "<%= name.underscore %>" self.label = "<%= name.underscore.humanize %>" # self.description = "Some description" # self.cols = 1 # self.initial_range = 30 # self.ranges = { # "7 days": 7, # "30 days": 30, # "60 days": 60, # "365 days": 365, # Today: "TODAY", # "Month to date": "MTD", # "Quarter to date": "QTD", # "Year to date": "YTD", # All: "ALL", # } # self.prefix = "" # self.suffix = "" def query # from = Date.today.midnight - 1.week # to = DateTime.current # if range.present? # if range.to_s == range.to_i.to_s # from = DateTime.current - range.to_i.days # else # case range # when "TODAY" # from = DateTime.current.beginning_of_day # when "MTD" # from = DateTime.current.beginning_of_month # when "QTD" # from = DateTime.current.beginning_of_quarter # when "YTD" # from = DateTime.current.beginning_of_year # when "ALL" # from = Time.at(0) # end # end # end # result User.where(created_at: from..to).count result 101 end end
Version data entries
81 entries across 81 versions & 1 rubygems