Hello devs i'm working on a filter by service in report modulo.
this is how it looks in my controller.
if !params[:service_request][:benefit_id].blank?
@service_requests = @service_requests.joins(:service).where(service: {benefit_id: params[:service_request][:benefit_id]})
end
all the data is in my @indicators variable which is an array
in my views i have a graphic with the data like this
= pie_chart @indicators[1..@indicators.size]
i'm looping through this array like this to generate cards with the information that i already have
- @indicator[1..@indicator.size].each_with_index do |indicator, i|
.col-lg-6.p-2
.card{"style"=>"height: 180px;"}
.card-header.text-center.cartas-header.text-white
%b=indicator[0]
.card-body
-if indicator[2].blank?
%table.table.text-center
%thead
%tr
%th{:scope => "col"} Total de Solicitudes
%th{:scope => "col"} Estatus Solicitudes
%tbody
%tr
%td
%h3=indicator[1]
%td
%btn{"data-bs-target" => "#modal_status#{i}", "data-bs-toggle" => "modal", :type => "button"}
= image_tag("hospital.png", class:"img-fluid", style:"width:48px;")
the problem is that if i use my service filter which is a dropdown list, it works for the pie_chart but in my cards is returning the selected service plus other cards but with cero data, and i just want the selected card.
this is how i'm recieving the info in my parameters
Parameters: {"service_request"=>{"fecha_desde"=>"", "fecha_hasta"=>"", "benefit_id"=>"2", "model"=>"Consultar"}, "commit"=>"Buscar"}