Fix the where clause in Stats
Now properly show the last 90 days of data instead of strict quarters. With the previous code, on the 1st of january, april, july and october, only one day of data would be shown.
This commit is contained in:
parent
664d821dc0
commit
de01914fa7
1 changed files with 3 additions and 2 deletions
|
@ -1,8 +1,9 @@
|
|||
class StatsController < ApplicationController
|
||||
|
||||
def index
|
||||
procedures = Procedure.where(created_at: Time.current.all_quarter).group("date_trunc('day', created_at)").count
|
||||
dossiers = Dossier.where(created_at: Time.current.all_quarter).group("date_trunc('day', created_at)").count
|
||||
procedures = Procedure.where(:created_at => 90.days.ago..Time.now).group("date_trunc('day', created_at)").count
|
||||
dossiers = Dossier.where(:created_at => 90.days.ago..Time.now).group("date_trunc('day', created_at)").count
|
||||
|
||||
@procedures = clean_hash(procedures)
|
||||
@dossiers = clean_hash(dossiers)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue