From 7419056e2cce25c6105cbe560cf90e50ad1fb86f Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 3 Nov 2015 16:21:41 -0500 Subject: [PATCH] Track newly created cards --- app/models/card.rb | 2 ++ app/views/admin/dashboard/index.html.slim | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/card.rb b/app/models/card.rb index 6c1f6d1..d876c43 100644 --- a/app/models/card.rb +++ b/app/models/card.rb @@ -37,6 +37,8 @@ class Card < ActiveRecord::Base default_scope { order(:gameid) } + scope :new_this_week, -> { where('created_at > ?', 1.week.ago) } + def dokkan? dokkan_id != nil end diff --git a/app/views/admin/dashboard/index.html.slim b/app/views/admin/dashboard/index.html.slim index 1ae32f7..190b91e 100644 --- a/app/views/admin/dashboard/index.html.slim +++ b/app/views/admin/dashboard/index.html.slim @@ -5,8 +5,8 @@ .col-xs-3 = glyph 'credit-card', classes: 'large-icon' .col-xs-9.text-right - .huge XX - div New Cards! + .huge= Card.new_this_week.count + div New Cards This Week! a href="#" .panel-footer .pull-left View Details