diff --git a/action/action_auditoria.php b/action/action_auditoria.php index f9e11b5..c5a37c4 100644 --- a/action/action_auditoria.php +++ b/action/action_auditoria.php @@ -19,7 +19,22 @@ try { if ($_SERVER['REQUEST_METHOD'] === 'GET') { $data = $db->query( "WITH horarios AS ( - SELECT * FROM horario_view WHERE (periodo_id, facultad_id) = (:periodo_id, COALESCE(:facultad_id, facultad_id)) + SELECT *, + materia_nombre as materia, + carrera_nombre as carrera, + facultad_nombre as facultad, + nivel_nombre as nivel, + horario_hora + duracion_interval as horario_fin + FROM horario + left JOIN materia USING (materia_id) + JOIN carrera USING (carrera_id) + JOIN nivel USING (nivel_id) + JOIN facultad ON facultad.facultad_id = carrera.facultad_id + JOIN PERIODO_CARRERA USING (carrera_id) + JOIN PERIODO USING (periodo_id) + JOIN SALON USING (salon_id) + JOIN duracion USING (duracion_id) + WHERE (periodo_id, facultad.facultad_id) = (:periodo_id, COALESCE(:facultad_id, facultad.facultad_id)) ), fechas AS ( SELECT fechas_clase(h.horario_id) as registro_fecha_ideal, h.horario_id @@ -30,10 +45,10 @@ try { ) SELECT usuario.*, registro.*, profesor.*, horarios.*, fechas.*, - coalesce(estado_supervisor.estado_supervisor_id, sin_registro.estado_supervisor_id) as estado_supervisor_id, - coalesce(estado_supervisor.nombre, sin_registro.nombre) as nombre, - coalesce(estado_supervisor.estado_color, sin_registro.estado_color) as estado_color, - coalesce(estado_supervisor.estado_icon, sin_registro.estado_icon) as estado_icon, + COALESCE(estado_supervisor.estado_supervisor_id, sin_registro.estado_supervisor_id) as estado_supervisor_id, + COALESCE(estado_supervisor.nombre, sin_registro.nombre) as nombre, + COALESCE(estado_supervisor.estado_color, sin_registro.estado_color) as estado_color, + COALESCE(estado_supervisor.estado_icon, sin_registro.estado_icon) as estado_icon, justificador.usuario_nombre as justificador_nombre, justificador.usuario_clave as justificador_clave, facultad.facultad_nombre as justificador_facultad, diff --git a/auditoria.php b/auditoria.php index b515ff9..9cd88ab 100644 --- a/auditoria.php +++ b/auditoria.php @@ -474,7 +474,7 @@
El profesor registró su asistencia a las - {{clase_vista.registro_fecha?.slice(11, 16)}} + {{clase_vista.registro_fecha?.slice(11, 19)}}

query( "WITH horarios AS ( - SELECT * FROM horario_view JOIN horario_profesor USING (horario_id) WHERE :profesor_id = profesor_id - ), - fechas AS ( - SELECT fechas_clase(h.horario_id) as registro_fecha_ideal, h.horario_id - FROM horarios h - ) - SELECT - materia, - facultad, - carrera, - registro_fecha_ideal as fecha_clase, - horarios.horario_hora as hora_clase, - horarios.dia as dia_clase, - COALESCE( - TO_CHAR(registro_fecha::TIME, 'HH24:MI:SS'), - 'Sin registro' - ) as hora_registro - FROM horarios - JOIN fechas using (horario_id) - LEFT JOIN registro USING (horario_id, registro_fecha_ideal, profesor_id) - WHERE fechas.registro_fecha_ideal BETWEEN :fecha_inicio AND :fecha_fin - ORDER BY fechas.registro_fecha_ideal DESC, horarios.horario_id", + SELECT *, + CASE + WHEN horario_dia = 1 THEN 'Lunes' + WHEN horario_dia = 2 THEN 'Martes' + WHEN horario_dia = 3 THEN 'Miércoles' + WHEN horario_dia = 4 THEN 'Jueves' + WHEN horario_dia = 5 THEN 'Viernes' + WHEN horario_dia = 6 THEN 'Sábado' + WHEN horario_dia = 7 THEN 'Domingo' + END as dia, + horario_hora + duracion_interval as horario_fin + FROM horario + JOIN horario_profesor USING (horario_id) + JOIN materia USING (materia_id) + JOIN carrera USING (carrera_id) + JOIN facultad ON facultad.facultad_id = carrera.facultad_id + JOIN periodo_carrera USING (carrera_id) + JOIN periodo_view USING (periodo_id) + JOIN duracion USING (duracion_id) + WHERE :profesor_id = profesor_id and periodo_view.activo + ), + fechas AS ( + SELECT fechas_clase(h.horario_id) as registro_fecha_ideal, h.horario_id + FROM horarios h + ) + SELECT distinct + materia_nombre as materia, + facultad_nombre as facultad, + carrera_nombre as carrera, + registro_fecha_ideal as fecha_clase, + horarios.horario_hora as hora_clase, + horarios.horario_fin as fin_clase, + horarios.dia as dia_clase, + CASE + when registro_justificada THEN 'Justificada' + WHEN registro_retardo THEN 'Retardo' + WHEN registro_reposicion THEN 'Respuesta' + WHEN registro_fecha IS NOT NULL THEN 'Registrado' + ELSE 'Sin registro' END as registro, + TO_CHAR(registro_fecha::TIME, 'HH24:MI:SS') as hora_registro + FROM horarios + JOIN fechas using (horario_id) + LEFT JOIN registro USING (horario_id, registro_fecha_ideal, profesor_id) + WHERE registro.registro_fecha_ideal BETWEEN :fecha_inicio AND :fecha_fin + ORDER BY fecha_clase DESC, materia_nombre", [ ':fecha_inicio' => $input['fecha'] ?? $input['fecha_inicio'] ?? null, ':fecha_fin' => $input['fecha'] ?? $input['fecha_fin'] ?? null, ':profesor_id' => $profesor['profesor_id'], ] ); + echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); } catch (PDOException $th) { http_response_code(500); diff --git a/supervisor.php b/supervisor.php index 6ef54a2..016e988 100644 --- a/supervisor.php +++ b/supervisor.php @@ -316,6 +316,8 @@

Comentarios de la clase


+ +
Comentario diff --git a/ts/auditoría.ts b/ts/auditoría.ts index 656de1e..9c6eb8a 100644 --- a/ts/auditoría.ts +++ b/ts/auditoría.ts @@ -385,7 +385,7 @@ createApp({ async mounted() { $('div.modal#cargando').modal('show'); - await store.registros.fetch() + // await store.registros.fetch() await store.facultades.fetch() await store.estados.fetch() await store.bloques_horario.fetch()