From 855a29ce79b137499fa5ba367efd361446731426 Mon Sep 17 00:00:00 2001 From: Julio Lucero Date: Thu, 16 Oct 2025 08:45:57 -0300 Subject: [PATCH 1/2] Show count of puzzles in each table --- app/views/puzzles/index.html.erb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/views/puzzles/index.html.erb b/app/views/puzzles/index.html.erb index 5ad4687..56974c6 100644 --- a/app/views/puzzles/index.html.erb +++ b/app/views/puzzles/index.html.erb @@ -2,15 +2,20 @@ <%= button_to 'Logout', session_path(1), method: :delete, class: "btn" %> -

Pending Puzzles

+

Pending Puzzles - Total: <%= @pending_puzzles.count %>

<%= render partial: 'puzzles_table', locals: { puzzles: @pending_puzzles, actions: :pending } %> -

Approved Puzzles

+

+ Approved Puzzles - Total: <%= @approved_puzzles.count %> + <% if @approved_puzzles.count < 5 %> + ⚠️ + <% end %> +

<%= render partial: 'puzzles_table', locals: { puzzles: @approved_puzzles, actions: :approved } %> -

Rejected Puzzles

+

Rejected Puzzles - Total: <%= @rejected_puzzles.count %>

<%= render partial: 'puzzles_table', locals: { puzzles: @rejected_puzzles, actions: :rejected } %> -

Archive Puzzles

+

Archive Puzzles - Total: <%= @archived_puzzles.count %>

These puzzles have already been sent to the users.

<%= render partial: 'puzzles_table', locals: { puzzles: @archived_puzzles, actions: :archived } %> From d30817093ae9987abca96e59a1c6e26ba6a6ab42 Mon Sep 17 00:00:00 2001 From: Julio Lucero Date: Fri, 17 Oct 2025 10:50:43 -0300 Subject: [PATCH 2/2] Improvements, use length and remove unnecesary style --- app/views/puzzles/index.html.erb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/views/puzzles/index.html.erb b/app/views/puzzles/index.html.erb index 56974c6..ead1a1e 100644 --- a/app/views/puzzles/index.html.erb +++ b/app/views/puzzles/index.html.erb @@ -2,20 +2,18 @@ <%= button_to 'Logout', session_path(1), method: :delete, class: "btn" %> -

Pending Puzzles - Total: <%= @pending_puzzles.count %>

+

Pending Puzzles - Total: <%= @pending_puzzles.length %>

<%= render partial: 'puzzles_table', locals: { puzzles: @pending_puzzles, actions: :pending } %>

- Approved Puzzles - Total: <%= @approved_puzzles.count %> - <% if @approved_puzzles.count < 5 %> - ⚠️ - <% end %> + Approved Puzzles - Total: <%= @approved_puzzles.length %> + <% if @approved_puzzles.length < 5 %>⚠️<% end %>

<%= render partial: 'puzzles_table', locals: { puzzles: @approved_puzzles, actions: :approved } %> -

Rejected Puzzles - Total: <%= @rejected_puzzles.count %>

+

Rejected Puzzles

<%= render partial: 'puzzles_table', locals: { puzzles: @rejected_puzzles, actions: :rejected } %> -

Archive Puzzles - Total: <%= @archived_puzzles.count %>

+

Archive Puzzles - Total: <%= @archived_puzzles.length %>

These puzzles have already been sent to the users.

<%= render partial: 'puzzles_table', locals: { puzzles: @archived_puzzles, actions: :archived } %>