Commit 4e671faa20ecfc4564d3e40e7ac156c3212f0be8
1 parent
174569b6
Exists in
master
inverte uma consulta potencialmente pesada de forma que deve otimizar a emissão de senhas
git-svn-id: http://svn.softwarepublico.gov.br/svn/sistemadeatendimento/sistema/trunk@40 63db2ce5-8a6c-0410-abb9-a418dd412890
Showing
1 changed file
with
7 additions
and
4 deletions
Show diff stats
Fila-Servico/lib/Fila/Servico/Controller/WS/Gestao/Senha.pm
... | ... | @@ -191,10 +191,13 @@ sub solicitar_senha :WSDLPort('GestaoSenha') :DBICTransaction('DB') :MI { |
191 | 191 | } |
192 | 192 | |
193 | 193 | # verificar se a senha está disponível. |
194 | - my $verificar = $c->stash->{local}->atendimentos_atuais->search | |
195 | - ({ 'senha.id_categoria' => $id_categoria, | |
196 | - 'senha.codigo' => $codigo_senha_atual }, | |
197 | - { join => 'senha' }); | |
194 | + my $verificar = $c->model('DB::Senha')->search | |
195 | + ({ 'me.id_categoria' => $id_categoria, | |
196 | + 'me.codigo' => $codigo_senha_atual, | |
197 | + 'atendimentos.vt_ini' => { '>=' => $now }, | |
198 | + 'atendimentos.vt_fim' => { '<' => $now }, | |
199 | + 'atendimentos.id_local' => $c->stash->{local}->id_local }, | |
200 | + { join => 'atendimentos' }); | |
198 | 201 | if ($verificar->first) { |
199 | 202 | goto CHECARSENHA; |
200 | 203 | } | ... | ... |