Skip to content

Commit

Permalink
Display removed scrapers on the stats page
Browse files Browse the repository at this point in the history
  • Loading branch information
Earlopain committed Oct 11, 2023
1 parent 17532f4 commit 84ee8dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/stats_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def index
"count(*) as file_count",
).joins(artist_submission: { artist_url: :artist }).group(:site_type).index_by(&:site_type)
@counts.transform_keys! { |id| ArtistUrl.site_types.invert[id] }
@definitions = (Sites.scraper_definitions + [Sites.from_enum("manual")]).sort_by(&:display_name)
@definitions = Sites.definitions.sort_by(&:display_name)
end

private
Expand Down
3 changes: 3 additions & 0 deletions app/views/stats/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<tbody>
<% @definitions.each do |definition| %>
<% entry = @counts[definition.site_type] || {} %>
<% next if definition.instance_of?(Sites::SimpleDefinition) && !entry["file_count"] %>
<tr>
<td><%= link_to_if(definition.site_type != "manual", definition.display_name, config_path(definition.site_type)) %></td>
<td><%= link_to(entry["artist_count"] || 0, artists_path(search: { site_type: definition.site_type })) %></td>
Expand All @@ -26,6 +27,8 @@
<% elsif definition.missing_config_keys.any? %>
Missing config <%= "key".pluralize(definition.missing_config_keys.count) %>:<br>
<%= definition.missing_config_keys.join(", ") %>
<% elsif definition.instance_of?(Sites::SimpleDefinition) %>
Removed
<% else %>
Enabled
<% end %>
Expand Down

1 comment on commit 84ee8dc

@faucetlol
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, removed scrapers probably shouldn't link to the config path though, otherwise it's just a link to a page that raises an undefined method 'all_config_keys' exception.

Please sign in to comment.