All
This commit is contained in:
@@ -29,6 +29,7 @@ try {
|
||||
"WITH horarios AS (
|
||||
SELECT
|
||||
horario_id,
|
||||
facultad.facultad_id,
|
||||
horario_fecha_inicio,
|
||||
horario_fecha_fin,
|
||||
horario_grupo,
|
||||
@@ -55,31 +56,35 @@ try {
|
||||
fechas AS (
|
||||
SELECT fechas_clase(h.horario_id, true) as registro_fecha_ideal, h.horario_id
|
||||
FROM horarios h
|
||||
),
|
||||
sin_registro AS (
|
||||
SELECT * FROM ESTADO_SUPERVISOR WHERE (estado_color, estado_icon) = ('dark', 'ing-cancelar')
|
||||
)
|
||||
SELECT
|
||||
usuario.usuario_nombre,
|
||||
registro.registro_id, registro.registro_fecha, registro.registro_retardo, registro.registro_justificada, comentario, registro_fecha_supervisor justificacion, registro_fecha_justificacion,
|
||||
registro.registro_id,
|
||||
registro.registro_fecha,
|
||||
registro.registro_retardo,
|
||||
registro.registro_justificada,
|
||||
registro_fecha_supervisor,
|
||||
justificacion,
|
||||
comentario,
|
||||
registro_fecha_justificacion,
|
||||
profesor.profesor_id, profesor_nombre, profesor_clave, profesor_correo,
|
||||
horarios.*,
|
||||
registro_fecha_ideal,
|
||||
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,
|
||||
materia, carrera, horarios.facultad_id, facultad, nivel, horario_hora, horario_fin, horario_grupo, salon,
|
||||
fechas.registro_fecha_ideal,
|
||||
estado_supervisor.estado_supervisor_id as estado_supervisor_id,
|
||||
estado_supervisor.nombre as nombre,
|
||||
estado_supervisor.estado_color as estado_color,
|
||||
estado_supervisor.estado_icon as estado_icon,
|
||||
justificador.usuario_nombre as justificador_nombre,
|
||||
justificador.usuario_clave as justificador_clave,
|
||||
facultad.facultad_nombre as justificador_facultad,
|
||||
rol.rol_titulo as justificador_rol
|
||||
rol.rol_titulo as justificador_rol,
|
||||
CASE WHEN registro_retardo THEN 'warning' ELSE 'primary' END as color
|
||||
FROM horarios
|
||||
JOIN fechas using (horario_id)
|
||||
JOIN horario_profesor using (horario_id)
|
||||
JOIN profesor using (profesor_id)
|
||||
LEFT JOIN registro USING (horario_id, registro_fecha_ideal, profesor_id)
|
||||
LEFT join estado_supervisor using (estado_supervisor_id)
|
||||
CROSS JOIN sin_registro
|
||||
join estado_supervisor ON estado_supervisor.estado_supervisor_id = COALESCE(registro.estado_supervisor_id, 0)
|
||||
LEFT JOIN USUARIO ON USUARIO.usuario_id = REGISTRO.supervisor_id
|
||||
LEFT JOIN USUARIO JUSTIFICADOR ON JUSTIFICADOR.usuario_id = REGISTRO.justificador_id
|
||||
LEFT JOIN ROL on ROL.rol_id = justificador.rol_id
|
||||
|
||||
Reference in New Issue
Block a user