From 0b397369d185edee7d890f09786fd3450355d89c Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Mon, 18 Nov 2024 14:38:45 +0000 Subject: [PATCH] fix: set a default value for ID's Closes #51 --- src/bin/update_data.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bin/update_data.rs b/src/bin/update_data.rs index 414fbb7..c578ac2 100644 --- a/src/bin/update_data.rs +++ b/src/bin/update_data.rs @@ -98,9 +98,18 @@ async fn update_ldap(config: &Config, db: &Pool) { } impl From<&WolvesResultUser> for AccountWolves { fn from(input: &WolvesResultUser) -> Self { + let id_student = match input.student_id.to_owned() { + None => { + Some("00000000".to_string()) + } + Some(x) => { + Some(x) + } + }; + AccountWolves { id_wolves: input.member_id.parse::().unwrap_or(0), - id_student: input.student_id.to_owned(), + id_student, email: input.contact_email.to_owned(), expiry: input.expiry.to_owned(), name_first: Some(input.first_name.to_owned()),