Sin auditoría Mat
This commit is contained in:
@@ -19,7 +19,6 @@ $user = unserialize($_SESSION['user']);
|
||||
// check method
|
||||
try {
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// pg_send_query($db->getConnection(), "REFRESH MATERIALIZED VIEW CONCURRENTLY PUBLIC.AUDITORIA_MAT");
|
||||
$baseDate = $_GET['fecha'] ?? $_GET['fecha_fin'] ?? null;
|
||||
|
||||
$params = [
|
||||
@@ -33,9 +32,9 @@ try {
|
||||
// Define relevant columns
|
||||
$relevant_columns = [
|
||||
'registro_id',
|
||||
'registro_fecha_ideal',
|
||||
'horario_id',
|
||||
'profesor_id',
|
||||
'fechas.registro_fecha_ideal',
|
||||
'fechas.horario_id',
|
||||
'profesor.profesor_id',
|
||||
'salon',
|
||||
'profesor_clave',
|
||||
'profesor_nombre',
|
||||
@@ -56,20 +55,21 @@ try {
|
||||
$RelevantColumns = implode(', ', $relevant_columns);
|
||||
|
||||
$_SESSION['fecha_inicio'] = $_GET['fecha'] ?? $_GET['fecha_inicio'] ?? date('Y-m-d');
|
||||
$_SESSION['fecha_fin'] = date('Y-m-d H:i:s', strtotime(($baseDate ?? 'now') . ' +24 hours'));
|
||||
$_SESSION['fecha_fin'] = date('Y-m-d H:i:s', strtotime($baseDate ?? 'now'));
|
||||
|
||||
$fechas = [
|
||||
'fecha_inicio' => $_SESSION['fecha_inicio'],
|
||||
'fecha_fin' => $_SESSION['fecha_fin'],
|
||||
];
|
||||
|
||||
|
||||
$PeriodosHorarios = implode(',', array_column(
|
||||
$db->query(
|
||||
'SELECT periodo_id FROM periodo WHERE (:fecha_inicio, :fecha_fin) OVERLAPS (periodo_fecha_inicio, periodo_fecha_fin)',
|
||||
$fechas
|
||||
),
|
||||
'periodo_id'
|
||||
));
|
||||
)) ?: 0;
|
||||
|
||||
|
||||
$DaysWeek = implode(',', array_values(array_unique(array_map(
|
||||
@@ -79,7 +79,7 @@ try {
|
||||
new DateInterval('P1D'),
|
||||
(new DateTime($_SESSION['fecha_fin']))->modify('+1 day')
|
||||
))
|
||||
))));
|
||||
)))) ?: 0;
|
||||
|
||||
$_SESSION['horarios'] = $HorariosID = implode(',', array_column($db->query(
|
||||
"SELECT horario_id FROM horario
|
||||
@@ -90,7 +90,7 @@ try {
|
||||
array_merge($fechas, [
|
||||
':facultad_id' => $user->facultad['facultad_id'],
|
||||
])
|
||||
), 'horario_id'));
|
||||
), 'horario_id')) ?: 0;
|
||||
|
||||
|
||||
$Horarios = $db->query(
|
||||
@@ -100,8 +100,10 @@ try {
|
||||
_todos => false,
|
||||
_fecha_inicio => :fecha_inicio,
|
||||
_fecha_fin => :fecha_fin
|
||||
) AS registro_fecha_ideal, h.horario_id
|
||||
FROM horario h WHERE horario_id IN ($HorariosID)
|
||||
) AS registro_fecha_ideal, h.horario_id, profesor_id
|
||||
FROM horario h
|
||||
JOIN horario_profesor USING (horario_id)
|
||||
WHERE horario_id IN ($HorariosID)
|
||||
)
|
||||
SELECT
|
||||
$RelevantColumns,
|
||||
@@ -110,11 +112,13 @@ try {
|
||||
ELSE 'primary'
|
||||
END AS color
|
||||
FROM horario
|
||||
NATURAL JOIN fechas
|
||||
NATURAL JOIN horario_profesor
|
||||
NATURAL JOIN profesor
|
||||
NATURAL JOIN salon
|
||||
LEFT JOIN REGISTRO USING (profesor_id, registro_fecha_ideal, horario_id)
|
||||
JOIN fechas USING (horario_id)
|
||||
JOIN profesor USING (profesor_id)
|
||||
JOIN salon USING (salon_id)
|
||||
LEFT JOIN REGISTRO ON
|
||||
REGISTRO.profesor_id = PROFESOR.profesor_id AND
|
||||
REGISTRO.horario_id = FECHAS.horario_id AND
|
||||
FECHAS.registro_fecha_ideal = REGISTRO.registro_fecha_ideal
|
||||
LEFT JOIN usuario ON usuario.usuario_id = REGISTRO.supervisor_id
|
||||
JOIN estado_supervisor ON estado_supervisor.estado_supervisor_id = COALESCE(REGISTRO.estado_supervisor_id, 0)
|
||||
ORDER BY fechas.registro_fecha_ideal, horario_hora",
|
||||
|
||||
@@ -33,6 +33,7 @@ try {
|
||||
facultad_nombre as facultad,
|
||||
carrera_nombre as carrera,
|
||||
registro_fecha,
|
||||
registro_fecha_supervisor,
|
||||
estado_color,
|
||||
estado_supervisor.estado_supervisor_id,
|
||||
estado_supervisor.nombre,
|
||||
@@ -40,7 +41,7 @@ try {
|
||||
usuario_nombre,
|
||||
horario_grupo,
|
||||
registro_retardo,
|
||||
justificada,
|
||||
registro_justificada,
|
||||
justificacion,
|
||||
comentario,
|
||||
CASE
|
||||
@@ -65,11 +66,6 @@ try {
|
||||
AND profesor.profesor_id = :profesor_id",
|
||||
$_GET
|
||||
);
|
||||
/* ->where('registro_fecha_ideal', $_GET['registro_fecha_ideal'])
|
||||
->where('horario_id', $_GET['horario_id'])
|
||||
->where('profesor_id', $_GET['profesor_id'])
|
||||
->getOne('auditoria_mat'); */
|
||||
// Print the JSON file
|
||||
echo json_encode($data);
|
||||
} else {
|
||||
http_response_code(405);
|
||||
|
||||
@@ -39,9 +39,6 @@ try {
|
||||
]
|
||||
);
|
||||
|
||||
$db->query("REFRESH MATERIALIZED VIEW CONCURRENTLY PUBLIC.AUDITORIA_MAT");
|
||||
|
||||
|
||||
$data_justificador = $db->querySingle(
|
||||
"SELECT justificador.usuario_nombre as justificador_nombre,
|
||||
justificador.usuario_clave as justificador_clave,
|
||||
|
||||
Reference in New Issue
Block a user