diff --git a/app/controllers/admins/pens/micro_clusters_controller.rb b/app/controllers/admins/pens/micro_clusters_controller.rb index 8f1e1d9d5..e7c0d782c 100644 --- a/app/controllers/admins/pens/micro_clusters_controller.rb +++ b/app/controllers/admins/pens/micro_clusters_controller.rb @@ -22,6 +22,18 @@ def index end end + def ignored + @clusters = + Pens::MicroCluster + .ignored + .joins(:collected_pens) + .select("pens_micro_clusters.*, count(*) as count") + .group("pens_micro_clusters.id") + .order( + "count desc, simplified_brand, simplified_model, simplified_color, simplified_material, simplified_trim_color, simplified_filling_system" + ) + end + def update cluster = Pens::MicroCluster.find(params[:id]) cluster.update!(update_params) diff --git a/app/views/admins/micro_clusters/ignored.html.slim b/app/views/admins/micro_clusters/ignored.html.slim index 97b77b0ca..54620fa0f 100644 --- a/app/views/admins/micro_clusters/ignored.html.slim +++ b/app/views/admins/micro_clusters/ignored.html.slim @@ -3,6 +3,7 @@ div class="fpc-table fpc-table--full-width fpc-scroll-shadow" thead tr th ID + th Count th Brand th Line th Name diff --git a/app/views/admins/pens/micro_clusters/ignored.html.slim b/app/views/admins/pens/micro_clusters/ignored.html.slim new file mode 100644 index 000000000..b6410cb1a --- /dev/null +++ b/app/views/admins/pens/micro_clusters/ignored.html.slim @@ -0,0 +1,23 @@ +div class="fpc-table fpc-table--full-width fpc-scroll-shadow" + table class="table align-middle table-striped" + thead + tr + th ID + th Count + th Brand + th Model + th Color + th Material + th Trim Color + th Filling System + tbody + - @clusters.each do |cluster| + tr + td= cluster.id + td= cluster.count + td= cluster.simplified_brand + td= cluster.simplified_model + td= cluster.simplified_color + td= cluster.simplified_material + td= cluster.simplified_trim_color + td= cluster.simplified_filling_system diff --git a/app/views/layouts/admin/_header.html.slim b/app/views/layouts/admin/_header.html.slim index a8a4fe505..8b834cc97 100644 --- a/app/views/layouts/admin/_header.html.slim +++ b/app/views/layouts/admin/_header.html.slim @@ -22,6 +22,7 @@ nav class="fpc-header navbar navbar-dark navbar-expand-md" id="header" a href="#" class="nav-link dropdown-toggle" role="button" data-bs-toggle="dropdown" aria-expanded="false" Pens ul class="dropdown-menu" li= link_to "Clustering app", admins_pens_micro_clusters_path, class: "dropdown-item" + li= link_to "Ignored Micro Clusters", ignored_admins_pens_micro_clusters_path, class: "dropdown-item" li= link_to "Sidekiq", sidekiq_web_path, class: "nav-link" li= link_to "Blog", admins_blog_posts_path, class: "nav-link" li class="dropdown" diff --git a/config/routes.rb b/config/routes.rb index e7ceae3c8..dae7c7a64 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -110,7 +110,9 @@ end namespace :pens do - resources :micro_clusters, only: %i[index update] + resources :micro_clusters, only: %i[index update] do + collection { get "ignored" } + end resources :model_variants, only: %i[index create show] end