Commit 8ee140bf authored by Guilherme Silva's avatar Guilherme Silva
Browse files

Alteração na verficação de substituição pendente

parent 2f4f40ff
......@@ -130,9 +130,9 @@ class AdministradorController extends Controller
}
// Verficação de pendencia de substituição
$aux = count(Arquivo::whereIn('participanteId',$trabalho->participantes->pluck('id'))->get());
$aux = count(Substituicao::where('status','Em Aguardo')->whereIn('participanteSubstituido_id',$trabalho->participantes->pluck('id'))->get());
$flagSubstituicao = 1;
if($aux != count($trabalho->participantes->pluck('id'))){
if($aux != 0){
$flagSubstituicao = -1;
}
......
......@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Arquivo;
use App\Notificacao;
use App\Substituicao;
use App\Trabalho;
use App\User;
use Auth;
......@@ -125,8 +126,8 @@ class ArquivoController extends Controller
$participantes = $trabalho->participantes;
// Verficação de pendencia de substituição
$aux = count(Arquivo::whereIn('participanteId',$trabalho->participantes->pluck('id'))->get());
if($aux != count($trabalho->participantes->pluck('id'))){
$aux = count(Substituicao::where('status','Em Aguardo')->whereIn('participanteSubstituido_id',$trabalho->participantes->pluck('id'))->get());
if($aux != 0){
return redirect()->back()->withErrors("A proposta ".$trabalho->titulo." possui substituições pendentes");
}
......
......@@ -9,6 +9,7 @@ use App\GrandeArea;
use App\ParecerInterno;
use App\Participante;
use App\SubArea;
use App\Substituicao;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Trabalho;
......@@ -108,9 +109,9 @@ class AvaliadorController extends Controller
$trabalho = $avaliador->trabalhos->find($request->trabalho_id);
$evento = Evento::find($request->evento);
// Verficação de pendencia de substituição
$aux = count(Arquivo::whereIn('participanteId',$trabalho->participantes->pluck('id'))->get());
if($aux != count($trabalho->participantes->pluck('id'))){
// Verficação de pendencia de substituição
$aux = count(Substituicao::where('status','Em Aguardo')->whereIn('participanteSubstituido_id',$trabalho->participantes->pluck('id'))->get());
if($aux != 0){
return redirect()->back()->withErrors("A proposta ".$trabalho->titulo." possui substituições pendentes");
}
......
......@@ -396,9 +396,9 @@ class TrabalhoController extends Controller
$arquivos = Arquivo::where('trabalhoId', $id)->get();
// Verficação de pendencia de substituição
$aux = count(Arquivo::whereIn('participanteId',$projeto->participantes->pluck('id'))->get());
$aux = count(Substituicao::where('status','Em Aguardo')->whereIn('participanteSubstituido_id',$projeto->participantes->pluck('id'))->get());
$flagSubstituicao = 1;
if($aux != count($projeto->participantes->pluck('id'))){
if($aux != 0){
$flagSubstituicao = -1;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment