From 81b859aca9fa4522302c4bd7f8b1e72a97e43b9c Mon Sep 17 00:00:00 2001 From: Mariano Riefolo Date: Thu, 3 Oct 2024 19:14:37 +0200 Subject: [PATCH] refactor(api): change 'docente' variable name to 'teacher' in get_header function --- src/api/mod.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/api/mod.rs b/src/api/mod.rs index 62348ec..382c594 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -211,10 +211,10 @@ pub async fn get_class(Query(params): Query) -> impl IntoRes } pub fn get_header(record: &StringRecord, header: Option
) -> Header { - let mut docente: Option = None; + let mut teacher: Option = 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 { 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 { - teacher: docente, - weekdays, - } + Header { teacher, weekdays } } pub fn get_header_wrapper(rdr: &mut Reader<&[u8]>) -> Header {