public function post($id, Request $request) { $idEvaluation = Evaluation::join('type_evaluations', 'type_evaluations.id', '=', 'evaluations.type_evaluation_id')->where('evaluations.id', $id)->first(); $criteres = CritereTypeEvaluation::join('criteres', 'criteres.id', '=', 'critere_type_evaluation.critere_id')->where('type_evaluation_id', $idEvaluation->type_evaluation_id)->get(); //$enseignant = EnseignantEvaluationRole::where('enseignant_id', ) // ->where('evaluation_id', $id) // ->first(); $total = 0; foreach ($criteres as $key => $critere) { //enseignant_id dans le foreach à rajouter CritereEnseignantEvaluation::insert([['noteCritere' => $request->input('critere' . $critere->critere_id), 'critere_id' => $critere->critere_id, 'enseignant_id' => 4, 'evaluation_id' => $id]]); $total = $total + $request->input('critere' . $critere->critere_id); } //if ($enseigant->role_id==1) { // $total=($total+$idEvaluation->noteGroupe)/2; //} Evaluation::where('evaluations.id', $id)->update(['noteGroupe' => $total]); //mettre le jury en à voté EnseignantEvaluationRole::where('enseignant_id', 4)->where('evaluation_id', $id)->update(['vote' => 1]); //retour selon maitre ou esclave //if ($enseigant->role_id==1) { // return redirect()->action('RecapitulationController@show',$id); //}else{ // return redirect()->action('GroupeProjetController@index'); //} return redirect()->action('RecapitulationController@show', $id); }
public function post($id, Request $request) { $idEvaluation = Evaluation::join('type_evaluations', 'type_evaluations.id', '=', 'evaluations.type_evaluation_id')->where('evaluations.id', $id)->first(); $criteres = CritereTypeEvaluation::join('criteres', 'criteres.id', '=', 'critere_type_evaluation.critere_id')->where('type_evaluation_id', $idEvaluation->type_evaluation_id)->get(); $etudiants = Etudiant::where('groupe_projet_id', $idEvaluation->groupe_projet_id)->get(); $roles = EnseignantEvaluationRole::join('roles', 'roles.id', '=', 'enseignant_evaluation_role.role_id')->join('enseignants', 'enseignants.id', '=', 'enseignant_evaluation_role.enseignant_id')->where('evaluation_id', $id)->get(); foreach ($etudiants as $key => $etudiant) { EtudiantEvaluation::insert([['noteIndividuelle' => $request->input('note' . $etudiant->id), 'remarqueIndividuelle' => '', 'etudiant_id' => $etudiant->id, 'evaluation_id' => $id]]); } foreach ($criteres as $key => $critere) { foreach ($roles as $key => $role) { CritereEnseignantEvaluation::where('enseignant_id', $role->enseignant_id)->where('evaluation_id', $id)->where('critere_id', $critere->critere_id)->update(['noteCritere' => $request->input('critere' . $critere->critere_id . $role->enseignant_id)]); } } Evaluation::where('evaluations.id', $id)->update(['noteGroupe' => $request->input('noteMoyGroupe')]); return redirect()->action('GroupeProjetController@index'); }