Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page listing ignored pens micro clusters #2169

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/controllers/admins/pens/micro_clusters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@
end
end

def ignored
@clusters =
Pens::MicroCluster

Check warning on line 27 in app/controllers/admins/pens/micro_clusters_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/admins/pens/micro_clusters_controller.rb#L27

Added line #L27 was not covered by tests
.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)
Expand Down
1 change: 1 addition & 0 deletions app/views/admins/micro_clusters/ignored.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions app/views/admins/pens/micro_clusters/ignored.html.slim
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions app/views/layouts/admin/_header.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading