diff --git a/app/Http/Controllers/EventoController.php b/app/Http/Controllers/EventoController.php index 45b2af6..bea301a 100644 --- a/app/Http/Controllers/EventoController.php +++ b/app/Http/Controllers/EventoController.php @@ -6,16 +6,19 @@ use App\Models\Dia; use App\Models\Evento; use App\Models\HoraFlag; use App\Models\Utils; -use Dotenv\Validator; +use Illuminate\Contracts\Foundation\Application; +use Illuminate\Contracts\View\Factory; +use Illuminate\Contracts\View\View; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use mysql_xdevapi\Exception; +use Illuminate\Http\Response; class EventoController extends Controller { /** * Display a listing of the resource. * - * @return \Illuminate\Http\Response + * @return Response */ public function index() { @@ -25,7 +28,7 @@ class EventoController extends Controller /** * Show the form for creating a new resource. * - * @return \Illuminate\Http\Response + * @return Response */ public function create() { @@ -35,13 +38,13 @@ class EventoController extends Controller /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse + * @param Request $request + * @return RedirectResponse */ public function store(Request $request) { $request->validate([ - 'nombre' => 'required', + 'nombre' => 'required' ]); $evento = new Evento(); $evento->nombre = $request->input("nombre"); @@ -52,8 +55,8 @@ class EventoController extends Controller /** * Display the specified resource. * - * @param \App\Models\Evento $evento - * @return \Illuminate\Http\Response + * @param Evento $evento + * @return Application|Factory|View|Response */ public function show(Evento $evento) { @@ -68,8 +71,8 @@ class EventoController extends Controller /** * Show the form for editing the specified resource. * - * @param \App\Models\Evento $evento - * @return \Illuminate\Http\Response + * @param Evento $evento + * @return Application|Factory|View|Response */ public function edit(Evento $evento) { return view("edit", ['evento' => $evento]); @@ -78,9 +81,9 @@ class EventoController extends Controller /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param \App\Models\Evento $evento - * @return \Illuminate\Http\RedirectResponse + * @param Request $request + * @param Evento $evento + * @return RedirectResponse */ public function update(Request $request, Evento $evento) { @@ -135,8 +138,8 @@ class EventoController extends Controller /** * Remove the specified resource from storage. * - * @param \App\Models\Evento $evento - * @return \Illuminate\Http\Response + * @param Evento $evento + * @return Response */ public function destroy(Evento $evento) { diff --git a/app/Models/Dia.php b/app/Models/Dia.php index 741dbd2..54f673f 100644 --- a/app/Models/Dia.php +++ b/app/Models/Dia.php @@ -31,19 +31,19 @@ class Dia extends Model // y en best["fin"] el minutoDelDía de la hora siguiente (esta hora existe porque si cant_actual // crece es porque llega a alguien, y por lo tanto hay una hora posterior en la que se va). // finalmente se devuelve best, con la duración del horario devuelto. - public function marzullo() { + public function marzullo(): array { // INICIO $cant_actual = 0; $best = ["cantidad" => 0, "inicio" => 0, "fin" => 0]; // Ordenar horaFlags por minutoDelDia - $horas = $this->horaFlags()->orderBy('minutoDelDia')->get(); + $horas = $this->horaFlags()->orderBy('minutoDelDia')->orderBy('flag')->get(); // var_dump($horas); // ALGORITMO foreach ($horas as $i => $hora) { $cant_actual += $hora->flag; if ($cant_actual > $best["cantidad"] && - ($horas[$i+1]->flag > 0 || $horas[$i+1]->minutoDelDia - $hora->minutoDelDia > 15)) { + ($horas[$i+1]->flag > 0 || $horas[$i+1]->minutoDelDia - $hora->minutoDelDia > 15)) { $best["cantidad"] = $cant_actual; $best["inicio"] = $hora->minutoDelDia; $best["fin"] = $horas[$i+1]->minutoDelDia;