Correção Dash Pendentes e falhas

This commit is contained in:
2026-06-22 17:47:05 -03:00
parent b742b2c2e3
commit 56b3e146bf
3 changed files with 96 additions and 29 deletions

View File

@@ -80,14 +80,19 @@ class DashboardController < ApplicationController
pagas = Entrega.da_conta_gade.pagas.no_periodo_checkout(@periodo_inicio, @periodo_fim)
pagas = pagas.da_operacoes(@operacao_filtro) if @operacao_filtro.present?
# PENDENTES (não concluídas) pela data planejada — não têm checkout.
# PENDENTES (em aberto, nem concluídas nem falhadas) pela data planejada.
pendentes = Entrega.da_conta_gade.pendentes.no_periodo(@periodo_inicio, @periodo_fim)
pendentes = pendentes.da_operacoes(@operacao_filtro) if @operacao_filtro.present?
# FALHADAS (insucesso) pela data planejada — também não têm checkout.
falhadas = Entrega.da_conta_gade.falhadas.no_periodo(@periodo_inicio, @periodo_fim)
falhadas = falhadas.da_operacoes(@operacao_filtro) if @operacao_filtro.present?
# Totais gerais
@entregas_pagas = pagas.count
@entregas_pendentes = pendentes.count
@total_entregas = @entregas_pagas + @entregas_pendentes
@entregas_falhadas = falhadas.count
@total_entregas = @entregas_pagas + @entregas_pendentes + @entregas_falhadas
# Configurações de preço
config = Configuracao.mapa_de_precos