fix: Correcion de filtro de examenes
This commit is contained in:
parent
26031d2c4d
commit
cc47523717
|
@ -220,7 +220,7 @@ class Graficos{
|
|||
$params[] = $filtros['fechaFin'];
|
||||
$types .= "ss";
|
||||
}
|
||||
$sql .= " GROUP BY ex.nombre_examen ORDER BY ex.nombre_examen";
|
||||
$sql .= " GROUP BY ex.id_examen, ex.nombre_examen ORDER BY ex.id_examen";
|
||||
|
||||
$query = $this->db->prepare($sql);
|
||||
if ($params) $query->bind_param($types, ...$params);
|
||||
|
|
|
@ -160,12 +160,25 @@ async function obtenerDatosEstados(filtros = {}) {
|
|||
}
|
||||
|
||||
async function obtenerDatosExamenes(filtros = {}) {
|
||||
try {
|
||||
const response = await fetch("../controllers/graficos.php", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ tipoConsulta: "Examenes", ...filtros }),
|
||||
body: JSON.stringify({
|
||||
tipoConsulta: "Examenes",
|
||||
...filtros
|
||||
}),
|
||||
});
|
||||
return await response.json();
|
||||
const data = await response.json();
|
||||
if (!Array.isArray(data)) {
|
||||
console.error("La respuesta del backend no es un array:", data);
|
||||
return [];
|
||||
}
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error("Error al obtener datos de exámenes:", error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
async function obtenerDatosFechas(filtros = {}) {
|
||||
|
|
Loading…
Reference in New Issue