fixing bug in mt_form

This commit is contained in:
Chris Cochrun 2024-01-09 06:03:11 -06:00
parent 2110516859
commit 715a997a1f

View file

@ -67,14 +67,40 @@ struct MtForm {
#[post("/mt-form")] #[post("/mt-form")]
pub async fn mt_form(MultipartForm(form): MultipartForm<MtForm>) -> HttpResponse { pub async fn mt_form(MultipartForm(form): MultipartForm<MtForm>) -> HttpResponse {
let first = form.first_name.as_ref().unwrap().0.clone(); let first = form
let last = form.last_name.as_ref().unwrap().0.clone(); .first_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.0
.clone();
let last = form
.last_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.0
.clone();
let email_subject = format!("{} {} signed up for mission trip!", first, last); let email_subject = format!("{} {} signed up for mission trip!", first, last);
let filename_noext = String::from(format!("{}_{}", first, last)); let filename_noext = String::from(format!("{}_{}", first, last));
let parent = format!( let parent = format!(
"{} {}", "{} {}",
form.parent_first_name.as_ref().unwrap().0.clone(), form.parent_first_name
form.parent_last_name.as_ref().unwrap().0.clone() .as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.0
.clone(),
form.parent_last_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.0
.clone()
); );
let birthdate = form let birthdate = form
.birthdate .birthdate