Skip to content

Commit

Permalink
Split external IDs into a separate group on the dashboard.
Browse files Browse the repository at this point in the history
  • Loading branch information
connorshea committed Nov 2, 2019
1 parent e66c8be commit 1b89be3
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 21 deletions.
9 changes: 7 additions & 2 deletions app/controllers/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ def dashboard
events: Event.count,
game_purchases: GamePurchase.count,
relationships: Relationship.count,
games_with_mobygames: Game.where.not(mobygames_id: nil),
games_with_pcgamingwiki: Game.where.not(pcgamingwiki_id: nil),
games_with_covers: Game.joins(:cover_attachment).count
}

@external_id_counts = {
mobygames_ids: Game.where.not(mobygames_id: nil).count,
pcgamingwiki_ids: Game.where.not(pcgamingwiki_id: nil).count,
wikidata_ids: Game.where.not(wikidata_id: nil).count,
steam_app_ids: Game.joins(:steam_app_ids).count
}
end

def wikidata_blocklist
Expand Down
55 changes: 36 additions & 19 deletions app/views/admin/dashboard.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,43 @@
<div class="ml-50 mr-50 mr-0-mobile ml-0-mobile">
<%= render 'admin_header' %>

<%# Breaks the counts into two separate levels. %>
<nav class="level">
<% @counts.to_a[0...(@counts.length / 2)].each do |key, count| %>
<div class="level-item has-text-centered">
<div>
<p class="heading"><%= key.to_s.titlecase %></p>
<p class="title"><%= count %></p>
<div class="card pt-15 pb-15">
<div class="has-text-centered has-text-weight-bold mb-25">Statistics</div>
<%# Breaks the counts into two separate levels. %>
<nav class="level">
<% @counts.to_a[0...(@counts.length / 2)].each do |key, count| %>
<div class="level-item has-text-centered">
<div>
<p class="heading"><%= key.to_s.titlecase %></p>
<p class="title"><%= count %></p>
</div>
</div>
</div>
<% end %>
</nav>
<% end %>
</nav>

<nav class="level">
<% @counts.to_a[(@counts.length / 2)..@counts.length].each do |key, count| %>
<div class="level-item has-text-centered">
<div>
<p class="heading"><%= key.to_s.titlecase %></p>
<p class="title"><%= count %></p>
<nav class="level">
<% @counts.to_a[(@counts.length / 2)..@counts.length].each do |key, count| %>
<div class="level-item has-text-centered">
<div>
<p class="heading"><%= key.to_s.titlecase %></p>
<p class="title"><%= count %></p>
</div>
</div>
</div>
<% end %>
</nav>
<% end %>
</nav>
</div>

<div class="card mt-30 pt-15 pb-15">
<div class="has-text-centered has-text-weight-bold mb-25">External Identifiers</div>
<nav class="level">
<% @external_id_counts.each do |key, count| %>
<div class="level-item has-text-centered">
<div>
<p class="heading"><%= key.to_s.titlecase %></p>
<p class="title"><%= count %></p>
</div>
</div>
<% end %>
</nav>
</div>
</div>

0 comments on commit 1b89be3

Please sign in to comment.