fixed bug in receiving non filled out zip
This commit is contained in:
parent
b09417eb32
commit
4004b1cf9d
|
@ -19,11 +19,10 @@ struct HealthForm {
|
|||
#[multipart(rename = "parentlastname")]
|
||||
parent_last_name: Option<Text<String>>,
|
||||
birthdate: Option<Text<String>>,
|
||||
gender: Option<Text<String>>,
|
||||
street: Option<Text<String>>,
|
||||
city: Option<Text<String>>,
|
||||
state: Option<Text<String>>,
|
||||
zip: Option<Text<i32>>,
|
||||
zip: Option<Text<String>>,
|
||||
#[multipart(rename = "cellphone")]
|
||||
parent_cellphone: Option<Text<String>>,
|
||||
homephone: Option<Text<String>>,
|
||||
|
@ -63,6 +62,7 @@ struct HealthForm {
|
|||
|
||||
#[post("/health-form")]
|
||||
pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> HttpResponse {
|
||||
log::info!("{:?}", form);
|
||||
let first = form
|
||||
.first_name
|
||||
.as_ref()
|
||||
|
@ -106,14 +106,6 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
|
|||
})
|
||||
.0
|
||||
.clone();
|
||||
let gender = form
|
||||
.gender
|
||||
.as_ref()
|
||||
.unwrap_or(&Text {
|
||||
0: String::from(""),
|
||||
})
|
||||
.0
|
||||
.clone();
|
||||
let street = form
|
||||
.street
|
||||
.as_ref()
|
||||
|
@ -138,7 +130,14 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
|
|||
})
|
||||
.0
|
||||
.clone();
|
||||
let zip = form.zip.as_ref().unwrap_or(&Text { 0: 0 }).0.clone();
|
||||
let zip = form
|
||||
.zip
|
||||
.as_ref()
|
||||
.unwrap_or(&Text {
|
||||
0: String::from(""),
|
||||
})
|
||||
.0
|
||||
.clone();
|
||||
let parent_cellphone = form
|
||||
.parent_cellphone
|
||||
.as_ref()
|
||||
|
@ -330,10 +329,6 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
|
|||
th { "Birthdate" }
|
||||
td { @birthdate }
|
||||
}
|
||||
tr {
|
||||
th { "Gender" }
|
||||
td { @gender }
|
||||
}
|
||||
tr {
|
||||
th { "Street" }
|
||||
td { @street }
|
||||
|
@ -479,7 +474,7 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
|
|||
.unwrap(),
|
||||
)
|
||||
.to("Chris Cochrun <chris@tfcconnection.org>".parse().unwrap())
|
||||
.to("Ethan Rose <ethan@tfcconnection.org>".parse().unwrap())
|
||||
// .to("Ethan Rose <ethan@tfcconnection.org>".parse().unwrap())
|
||||
.subject(email_subject)
|
||||
.multipart(multi)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue