This commit is contained in:
@@ -65,7 +65,7 @@ try {
|
||||
|
||||
$horarios_y_reposiciones = $db->query(
|
||||
"SELECT " . implode(', ', $columns) . <<<SQL
|
||||
, NULL, NULL, 0 AS tipo
|
||||
, NULL as reposicion_fin, NULL as registro_fecha_ideal, salon_view_mat.id_espacio_padre, 0 AS tipo
|
||||
FROM horario_view
|
||||
inner JOIN periodo using(periodo_id)
|
||||
JOIN bloque_horario ON (bloque_horario.hora_inicio, bloque_horario.hora_fin) OVERLAPS (horario_view.horario_hora, horario_view.horario_hora + horario_view.duracion)
|
||||
@@ -82,7 +82,7 @@ try {
|
||||
SQL . implode(', ', array_map(fn($s) => $s['id_espacio_sgu'], $data)) . <<<SQL
|
||||
)
|
||||
SQL . ' UNION ALL ' . 'SELECT ' . implode(', ', $columns) . <<<SQL
|
||||
, reposicion_hora + horario_view.duracion as reposicion_fin, registro_fecha_ideal, 1 AS tipo
|
||||
, reposicion_hora + horario_view.duracion as reposicion_fin, registro_fecha_ideal, salon_reposicion.id_espacio_padre, 1 AS tipo
|
||||
FROM horario_view
|
||||
inner JOIN periodo using(periodo_id)
|
||||
NATURAL JOIN registro
|
||||
@@ -96,25 +96,27 @@ try {
|
||||
AND reposicion_fecha = $fecha::DATE
|
||||
AND bloque_horario.id = :bloque_horario_id
|
||||
AND salon_reposicion.id_espacio_padre IN (
|
||||
SQL . implode(', ', array_map(fn($s) => $s['id_espacio_sgu'], $data)) <<<SQL
|
||||
SQL . implode(', ', array_map(fn($s) => $s['id_espacio_sgu'], $data)) . <<<SQL
|
||||
)
|
||||
SQL,
|
||||
[
|
||||
'bloque_horario_id' => $_GET['bloque_horario_id'],
|
||||
]
|
||||
);
|
||||
// echo '<pre>' . json_encode($horarios_y_reposiciones, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . '</pre>'; exit();
|
||||
|
||||
$data = array_map(
|
||||
fn($ruta) => array_merge(
|
||||
[
|
||||
'horarios' => array_filter(
|
||||
'horarios' => array_values(array_filter(
|
||||
$horarios_y_reposiciones,
|
||||
fn($horario) => $horario['id_espacio_sgu'] === $ruta['id_espacio_sgu'] && $horario['tipo'] === 0
|
||||
),
|
||||
fn($horario) => $horario['id_espacio_padre'] == $ruta['id_espacio_sgu'] && $horario['tipo'] == 0
|
||||
)),
|
||||
// 'query' => $db->getLastQuery(),
|
||||
'reposiciones' => array_filter(
|
||||
'reposiciones' => array_values(array_filter(
|
||||
$horarios_y_reposiciones,
|
||||
fn($horario) => $horario['id_espacio_sgu'] === $ruta['id_espacio_sgu'] && $horario['tipo'] === 1
|
||||
),
|
||||
fn($horario) => $horario['id_espacio_padre'] == $ruta['id_espacio_sgu'] && $horario['tipo'] == 1
|
||||
)),
|
||||
],
|
||||
$ruta,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user