From 6a6a31b77cc2d87ee97afde5117fb4d035f12083 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 3 Nov 2015 16:15:20 -0500 Subject: [PATCH] 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