fix: adjust class year, filter out unexpected weekdays and ignore useless CSV rows
This commit is contained in:
parent
4524d84ab9
commit
9fdd2d4161
@ -171,12 +171,7 @@ pub async fn get_class(Query(params): Query<FilterByClassQuery>) -> impl IntoRes
|
||||
for record in rdr.records() {
|
||||
let record = match record {
|
||||
Ok(x) => x,
|
||||
Err(_) => {
|
||||
return (
|
||||
StatusCode::UNPROCESSABLE_ENTITY,
|
||||
Json(json!({ "errore": "Formato non supportato"})),
|
||||
)
|
||||
}
|
||||
Err(_) => continue,
|
||||
};
|
||||
for (i, cell) in record.iter().enumerate() {
|
||||
if cell == params.classe {
|
||||
|
@ -54,7 +54,7 @@ function load_classes(id) {
|
||||
}
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const option = document.createElement("option");
|
||||
option.value = i;
|
||||
option.value = i + 1;
|
||||
option.text = i + 1;
|
||||
select.appendChild(option);
|
||||
}
|
||||
@ -87,12 +87,14 @@ function make_teacher_table(id, teacher) {
|
||||
th.scope = "row";
|
||||
th.textContent = weekday;
|
||||
tr.appendChild(th);
|
||||
data[weekday].forEach((teacher_class) => {
|
||||
let td = document.createElement("td");
|
||||
td.textContent = teacher_class;
|
||||
tr.appendChild(td);
|
||||
});
|
||||
tbody.appendChild(tr);
|
||||
if (data[weekday] == null) {
|
||||
data[weekday].forEach((teacher_class) => {
|
||||
let td = document.createElement("td");
|
||||
td.textContent = teacher_class;
|
||||
tr.appendChild(td);
|
||||
});
|
||||
tbody.appendChild(tr);
|
||||
}
|
||||
});
|
||||
table.appendChild(tbody);
|
||||
document.getElementById("table").removeAttribute("aria-busy");
|
||||
@ -123,12 +125,14 @@ function make_student_table(id, student_class) {
|
||||
th.scope = "row";
|
||||
th.textContent = weekday;
|
||||
tr.appendChild(th);
|
||||
data[weekday].forEach((student_class) => {
|
||||
let td = document.createElement("td");
|
||||
td.textContent = student_class;
|
||||
tr.appendChild(td);
|
||||
});
|
||||
tbody.appendChild(tr);
|
||||
if (data[weekday] != null) {
|
||||
data[weekday].forEach((student_class) => {
|
||||
let td = document.createElement("td");
|
||||
td.textContent = student_class;
|
||||
tr.appendChild(td);
|
||||
});
|
||||
tbody.appendChild(tr);
|
||||
}
|
||||
});
|
||||
table.appendChild(tbody);
|
||||
document.getElementById("table").removeAttribute("aria-busy");
|
||||
|
Loading…
Reference in New Issue
Block a user