refactor(api): change 'docente' variable name to 'teacher' in get_header function

This commit is contained in:
Mariano Riefolo 2024-10-03 19:14:37 +02:00
parent c5c6fb97e4
commit 81b859aca9

View File

@ -211,10 +211,10 @@ pub async fn get_class(Query(params): Query<FilterByClassQuery>) -> impl IntoRes
}
pub fn get_header(record: &StringRecord, header: Option<Header>) -> Header {
let mut docente: Option<u8> = None;
let mut teacher: Option<u8> = None;
let mut weekdays = HashMap::new();
if let Some(h) = header {
docente = h.teacher;
teacher = h.teacher;
weekdays = h.weekdays;
}
@ -228,7 +228,7 @@ pub fn get_header(record: &StringRecord, header: Option<Header>) -> Header {
let field = field.replace(" ", "").to_uppercase();
if field == "DOCENTE" {
docente = Some(i as u8);
teacher = Some(i as u8);
} else if field.starts_with("LUN") {
weekdays.insert("Lunedì".to_string(), i..next_index + i + 1);
} else if field.starts_with("MAR") {
@ -244,10 +244,7 @@ pub fn get_header(record: &StringRecord, header: Option<Header>) -> Header {
}
}
Header {
teacher: docente,
weekdays,
}
Header { teacher, weekdays }
}
pub fn get_header_wrapper(rdr: &mut Reader<&[u8]>) -> Header {