diff --git a/Gemfile b/Gemfile index d3ae856..bd2348d 100644 --- a/Gemfile +++ b/Gemfile @@ -36,7 +36,7 @@ gem "whenever", require: false gem "twilio-ruby" # WhatsApp — só envia se TWILIO_ACCOUNT_SID estiver no .env # Utilitários -gem "pagy" # paginação +gem "pagy", "~> 9.0" # paginação (fixado: API :limit e sem extra overflow) gem "image_processing", ">= 1.2" group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..cdfc2a2 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,379 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.1.6) + actionpack (= 7.1.6) + activesupport (= 7.1.6) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (7.1.6) + actionpack (= 7.1.6) + activejob (= 7.1.6) + activerecord (= 7.1.6) + activestorage (= 7.1.6) + activesupport (= 7.1.6) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.1.6) + actionpack (= 7.1.6) + actionview (= 7.1.6) + activejob (= 7.1.6) + activesupport (= 7.1.6) + mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.2) + actionpack (7.1.6) + actionview (= 7.1.6) + activesupport (= 7.1.6) + cgi + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.6) + actionpack (= 7.1.6) + activerecord (= 7.1.6) + activestorage (= 7.1.6) + activesupport (= 7.1.6) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.1.6) + activesupport (= 7.1.6) + builder (~> 3.1) + cgi + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.6) + activesupport (= 7.1.6) + globalid (>= 0.3.6) + activemodel (7.1.6) + activesupport (= 7.1.6) + activerecord (7.1.6) + activemodel (= 7.1.6) + activesupport (= 7.1.6) + timeout (>= 0.4.0) + activestorage (7.1.6) + actionpack (= 7.1.6) + activejob (= 7.1.6) + activerecord (= 7.1.6) + activesupport (= 7.1.6) + marcel (~> 1.0) + activesupport (7.1.6) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + mutex_m + securerandom (>= 0.3) + tzinfo (~> 2.0) + addressable (2.9.0) + public_suffix (>= 2.0.2, < 8.0) + annotate (3.2.0) + activerecord (>= 3.2, < 8.0) + rake (>= 10.4, < 14.0) + base64 (0.3.0) + bcrypt (3.1.22) + benchmark (0.5.0) + bigdecimal (3.3.1) + bindex (0.8.1) + builder (3.3.0) + capybara (3.40.0) + addressable + matrix + mini_mime (>= 0.1.3) + nokogiri (~> 1.11) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (>= 1.5, < 3.0) + xpath (~> 3.2) + cgi (0.5.1) + chronic (0.10.2) + chunky_png (1.4.0) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) + crass (1.0.6) + date (3.5.1) + debug (1.11.1) + irb (~> 1.10) + reline (>= 0.3.8) + devise (5.0.4) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 7.0) + responders + warden (~> 1.2.3) + diff-lcs (1.6.2) + dotenv (3.2.0) + dotenv-rails (3.2.0) + dotenv (= 3.2.0) + railties (>= 6.1) + drb (2.2.3) + erb (6.0.4) + erubi (1.13.1) + factory_bot (6.6.0) + activesupport (>= 6.1.0) + factory_bot_rails (6.5.1) + factory_bot (~> 6.5) + railties (>= 6.1.0) + faker (3.8.0) + i18n (>= 1.8.11, < 2) + faraday (2.14.3) + faraday-net_http (>= 2.0, < 3.5) + json + logger + faraday-net_http (3.4.4) + net-http (~> 0.5) + globalid (1.3.0) + activesupport (>= 6.1) + i18n (1.14.8) + concurrent-ruby (~> 1.0) + image_processing (2.0.2) + importmap-rails (2.2.3) + actionpack (>= 6.0.0) + activesupport (>= 6.0.0) + railties (>= 6.0.0) + io-console (0.8.2) + irb (1.18.0) + pp (>= 0.6.0) + prism (>= 1.3.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + jbuilder (2.15.1) + actionview (>= 7.0.0) + activesupport (>= 7.0.0) + json (2.19.9) + jwt (3.2.0) + base64 + logger (1.7.0) + loofah (2.25.1) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.9.0) + logger + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.2.1) + matrix (0.4.3) + mini_mime (1.1.5) + minitest (6.0.6) + drb (~> 2.0) + prism (~> 1.5) + mutex_m (0.3.0) + net-http (0.9.1) + uri (>= 0.11.1) + net-imap (0.6.4.1) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.1) + net-protocol + nio4r (2.7.5) + nokogiri (1.19.3-x86_64-linux-gnu) + racc (~> 1.4) + orm_adapter (0.5.0) + pagy (9.4.0) + pdf-core (0.10.0) + pg (1.6.3-x86_64-linux) + pp (0.6.3) + prettyprint + prawn (2.5.0) + matrix (~> 0.4) + pdf-core (~> 0.10.0) + ttfunk (~> 1.8) + prawn-table (0.2.2) + prawn (>= 1.3.0, < 3.0.0) + prettyprint (0.2.0) + prism (1.9.0) + propshaft (1.3.2) + actionpack (>= 7.0.0) + activesupport (>= 7.0.0) + rack + psych (5.4.0) + date + stringio + public_suffix (7.0.5) + puma (6.6.1) + nio4r (~> 2.0) + pundit (2.5.2) + activesupport (>= 3.0.0) + racc (1.8.1) + rack (3.2.6) + rack-mini-profiler (4.0.1) + rack (>= 1.2.0) + rack-session (2.1.2) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) + rack (>= 1.3) + rackup (2.3.1) + rack (>= 3) + rails (7.1.6) + actioncable (= 7.1.6) + actionmailbox (= 7.1.6) + actionmailer (= 7.1.6) + actionpack (= 7.1.6) + actiontext (= 7.1.6) + actionview (= 7.1.6) + activejob (= 7.1.6) + activemodel (= 7.1.6) + activerecord (= 7.1.6) + activestorage (= 7.1.6) + activesupport (= 7.1.6) + bundler (>= 1.15.0) + railties (= 7.1.6) + rails-dom-testing (2.3.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.7.0) + loofah (~> 2.25) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (7.1.6) + actionpack (= 7.1.6) + activesupport (= 7.1.6) + cgi + irb + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) + zeitwerk (~> 2.6) + rake (13.4.2) + rdoc (7.2.0) + erb + psych (>= 4.0.0) + tsort + regexp_parser (2.12.0) + reline (0.6.3) + io-console (~> 0.5) + responders (3.2.0) + actionpack (>= 7.0) + railties (>= 7.0) + rexml (3.4.4) + rqrcode (3.2.0) + chunky_png (~> 1.0) + rqrcode_core (~> 2.0) + rqrcode_core (2.1.0) + rspec-core (3.13.6) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.8) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-rails (7.1.1) + actionpack (>= 7.0) + activesupport (>= 7.0) + railties (>= 7.0) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) + rspec-support (3.13.7) + rubyzip (3.4.0) + securerandom (0.4.1) + selenium-webdriver (4.44.0) + base64 (~> 0.2) + logger (~> 1.4) + rexml (~> 3.2, >= 3.2.5) + rubyzip (>= 1.2.2, < 4.0) + websocket (~> 1.0) + stimulus-rails (1.3.4) + railties (>= 6.0.0) + stringio (3.2.0) + tailwindcss-rails (4.5.0) + railties (>= 7.0.0) + tailwindcss-ruby (~> 4.0) + tailwindcss-ruby (4.3.1-x86_64-linux-gnu) + thor (1.5.0) + timeout (0.6.1) + tsort (0.2.0) + ttfunk (1.8.0) + bigdecimal (~> 3.1) + turbo-rails (2.0.23) + actionpack (>= 7.1.0) + railties (>= 7.1.0) + twilio-ruby (7.10.7) + faraday (>= 2.0, < 3.0) + jwt (>= 1.5, < 4.0) + nokogiri (>= 1.6, < 2.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + uri (1.1.1) + warden (1.2.9) + rack (>= 2.0.9) + web-console (4.2.1) + actionview (>= 6.0.0) + activemodel (>= 6.0.0) + bindex (>= 0.4.0) + railties (>= 6.0.0) + websocket (1.2.11) + websocket-driver (0.8.1) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + whenever (1.1.2) + chronic (>= 0.6.3) + xpath (3.2.0) + nokogiri (~> 1.8) + zeitwerk (2.8.2) + +PLATFORMS + x86_64-linux + +DEPENDENCIES + annotate + capybara + chunky_png + debug + devise + dotenv-rails + factory_bot_rails + faker + image_processing (>= 1.2) + importmap-rails + jbuilder + pagy (~> 9.0) + pg (~> 1.1) + prawn + prawn-table + propshaft + puma (~> 6.0) + pundit + rack-mini-profiler + rails (~> 7.1.0) + rqrcode + rspec-rails + selenium-webdriver + stimulus-rails + tailwindcss-rails + turbo-rails + twilio-ruby + web-console + whenever + +RUBY VERSION + ruby 3.2.2p53 + +BUNDLED WITH + 2.4.10 diff --git a/Imagens para correção /Imagem colada (8).png b/Imagens para correção /Imagem colada (8).png new file mode 100644 index 0000000..47d7a51 Binary files /dev/null and b/Imagens para correção /Imagem colada (8).png differ diff --git a/app/controllers/consolidacao_entregas_controller.rb b/app/controllers/consolidacao_entregas_controller.rb index f8917a4..4f6cc1a 100644 --- a/app/controllers/consolidacao_entregas_controller.rb +++ b/app/controllers/consolidacao_entregas_controller.rb @@ -137,7 +137,11 @@ class ConsolidacaoEntregasController < ApplicationController # Paginação só da tabela exibida — 20 padrão, com seletor 20/50/100 @por_pagina = [20, 50, 100].include?(params[:por_pagina].to_i) ? params[:por_pagina].to_i : 20 - @pagy, @classificacoes = pagy(todas.order(:created_at), limit: @por_pagina) + begin + @pagy, @classificacoes = pagy(todas.order(:created_at), limit: @por_pagina) + rescue Pagy::OverflowError + @pagy, @classificacoes = pagy(todas.order(:created_at), limit: @por_pagina, page: 1) + end # Próximo motorista pendente (para botão "Próximo Motorista") nomes_completos = @consolidacao.consolidacao_motoristas.map(&:motorista_nome) diff --git a/config/initializers/pagy.rb b/config/initializers/pagy.rb index b98c3d3..65591de 100644 --- a/config/initializers/pagy.rb +++ b/config/initializers/pagy.rb @@ -1,7 +1,4 @@ # config/initializers/pagy.rb -require 'pagy/extras/overflow' - -# Página fora do intervalo cai na última página (evita erro ao trocar itens/página). -Pagy::DEFAULT[:overflow] = :last_page -# Itens por página padrão. +# Itens por página padrão. (Pagy 9 usa :limit; o extra "overflow" foi removido, +# então o tratamento de página fora do intervalo é feito no controller.) Pagy::DEFAULT[:limit] = 20