From 6a6a31b77cc2d87ee97afde5117fb4d035f12083 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 3 Nov 2015 16:15:20 -0500 Subject: [PATCH 1/2] Add some basic info to the dashboard --- app/models/card.rb | 4 ++++ app/models/link.rb | 4 ++++ app/models/passive_skill.rb | 4 ++++ app/models/super_attack.rb | 4 ++++ app/views/admin/dashboard/index.html.slim | 28 +++++++++++++++++++++++ 5 files changed, 44 insertions(+) diff --git a/app/models/card.rb b/app/models/card.rb index 01fb46f..6c1f6d1 100644 --- a/app/models/card.rb +++ b/app/models/card.rb @@ -49,6 +49,10 @@ class Card < ActiveRecord::Base "card_#{gameid}_thumb.png" end + def self.verified + Card.where(verified: true) + end + private def set_stat_types diff --git a/app/models/link.rb b/app/models/link.rb index a3b5b50..9fc5194 100644 --- a/app/models/link.rb +++ b/app/models/link.rb @@ -7,4 +7,8 @@ class Link < ActiveRecord::Base uniqueness: true default_scope { order(:name) } + + def self.issues + Link.where(description: nil) + end end diff --git a/app/models/passive_skill.rb b/app/models/passive_skill.rb index dd1b956..a9704fd 100644 --- a/app/models/passive_skill.rb +++ b/app/models/passive_skill.rb @@ -13,4 +13,8 @@ class PassiveSkill < ActiveRecord::Base def display_name name.present? ? name : 'UNNAMED' end + + def self.issues + PassiveSkill.where("name = '' OR description = ''") + end end diff --git a/app/models/super_attack.rb b/app/models/super_attack.rb index ad32ec1..fbaed27 100644 --- a/app/models/super_attack.rb +++ b/app/models/super_attack.rb @@ -10,4 +10,8 @@ class SuperAttack < ActiveRecord::Base def full "#{name} - #{description}" end + + def self.issues + SuperAttack.where("name = '' OR description = ''") + end end diff --git a/app/views/admin/dashboard/index.html.slim b/app/views/admin/dashboard/index.html.slim index 9a0b958..1ae32f7 100644 --- a/app/views/admin/dashboard/index.html.slim +++ b/app/views/admin/dashboard/index.html.slim @@ -26,3 +26,31 @@ .pull-left View Details .pull-right= glyph 'circle-arrow-right' .clearfix +.col-md-6 + .panel.panel-default + .panel-heading Card Stats + .panel-body + .list-group + a.list-group-item + = 'Total' + span.pull-right.text-muted= Card.count + a.list-group-item + = 'Verified' + span.pull-right.text-muted= Card.verified.count +.col-md-6 + .panel.panel-default + .panel-heading Potential Issues + .panel-body + .list-group + a.list-group-item + = 'Cards Without Links' + span.pull-right.text-muted= Card.where('links_count < 1').count + a.list-group-item + = 'Passive Skills missing information' + span.pull-right.text-muted= PassiveSkill.issues.count + a.list-group-item + = 'Super Attacks missing information' + span.pull-right.text-muted= SuperAttack.issues.count + a.list-group-item + = 'Links missing information' + span.pull-right.text-muted= Link.issues.count From 7419056e2cce25c6105cbe560cf90e50ad1fb86f Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 3 Nov 2015 16:21:41 -0500 Subject: [PATCH 2/2] 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