Rutas salón
Some checks are pending
Deploy Pruebas / deploy (push) Waiting to run

This commit is contained in:
Your Name
2024-10-08 11:59:02 -06:00
parent fab36e0f9b
commit 2dd40e1bb8

View File

@@ -62,10 +62,8 @@ try {
'salon_reposicion.salon as reposicion_salon',
];
$fecha = ($_GET['fecha'] != 'null') ? ("'{$_GET['fecha']}'" ?: 'CURRENT_DATE') : 'CURRENT_DATE';
$data = array_map(
fn($ruta) => array_merge(
[
'horarios' => $db->query(
$horarios_y_reposiciones = $db->query(
"SELECT " . implode(', ', $columns) . <<<SQL
, NULL, NULL, 0 AS tipo
FROM horario_view
@@ -80,17 +78,8 @@ try {
WHERE $fecha::DATE BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin
AND horario_dia = EXTRACT(DOW FROM $fecha::DATE)
AND bloque_horario.id = :bloque_horario_id
AND salon_view_mat.id_espacio_padre = :id_espacio_sgu
ORDER BY horario_hora, salon_view_mat.salon;
SQL,
[
'bloque_horario_id' => $_GET['bloque_horario_id'],
'id_espacio_sgu' => $ruta['id_espacio_sgu'],
]
),
// 'query' => $db->getLastQuery(),
'reposiciones' => $db->query(
'SELECT ' . implode(', ', $columns) . <<<SQL
AND salon_view_mat.id_espacio_padre IN :id_espacio_sgu
SQL . ' UNION ALL ' . 'SELECT ' . implode(', ', $columns) . <<<SQL
, reposicion_hora + horario_view.duracion as reposicion_fin, registro_fecha_ideal, 1 AS tipo
FROM horario_view
inner JOIN periodo using(periodo_id)
@@ -104,13 +93,25 @@ try {
AND periodo.periodo_fecha_fin
AND reposicion_fecha = $fecha::DATE
AND bloque_horario.id = :bloque_horario_id
AND salon_reposicion.id_espacio_padre = :id_espacio_sgu
AND salon_reposicion.id_espacio_padre IN :id_espacio_sgu
ORDER BY reposicion_hora
SQL,
[
'bloque_horario_id' => $_GET['bloque_horario_id'],
'id_espacio_sgu' => $ruta['id_espacio_sgu'],
'id_espacio_sgu' => array_column($data, 'id_espacio_sgu'),
]
);
$data = array_map(
fn($ruta) => array_merge(
[
'horarios' => array_filter(
$horarios_y_reposiciones,
fn($horario) => $horario['id_espacio_sgu'] === $ruta['id_espacio_sgu'] && $horario['tipo'] === 0
),
// 'query' => $db->getLastQuery(),
'reposiciones' => array_filter(
$horarios_y_reposiciones,
fn($horario) => $horario['id_espacio_sgu'] === $ruta['id_espacio_sgu'] && $horario['tipo'] === 1
),
],
$ruta,