linting issues

This commit is contained in:
Chris Cochrun 2024-06-25 06:30:09 -05:00
parent 9b70af3dba
commit 0330876377
7 changed files with 128 additions and 368 deletions

View file

@ -66,245 +66,185 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
let first = form
.first_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let last = form
.last_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let full_name = format!("{} {}", first, last);
let registration = form
.registration
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let email_subject = format!("{} {} filled out a health form!", first, last);
let filename_noext = String::from(format!("{}_{}", first, last));
let filename_noext = format!("{}_{}", first, last);
let parent = format!(
"{} {}",
form.parent_first_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.unwrap_or(&Text(String::from("")))
.0
.clone(),
form.parent_last_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.unwrap_or(&Text(String::from("")))
.0
.clone()
);
let birthdate = form
.birthdate
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let street = form
.street
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let city = form
.city
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let state = form
.state
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let zip = form
.zip
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let parent_cellphone = form
.parent_cellphone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let homephone = form
.homephone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let contact = form
.contact
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let contact_phone = form
.contact_phone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let doctorname = form
.doctorname
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let doctorcity = form
.doctorcity
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let doctorphone = form
.doctorphone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let medical = form
.medical
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let insurance = form
.insurance
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let policy_number = form
.policy_number
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let agreement = form
.agreement
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let allergies = form
.allergies
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let allergies_other = form
.allergies_other
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let specific_allergies = form
.specific_allergies
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let treatment = form
.treatment
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let conditions = form
.conditions
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let tetanus = form
.tetanus
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let swimming = form
.swimming
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let medication = form
.medication
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let notes = form
.notes
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
log::info!("{first} {last} filled out a health form!");
@ -444,7 +384,7 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
log::info!("{:?}", file_exists);
if let Some(f) = form.file {
if let Some(file) = f.file_name {
if let Some(ext) = file.rsplit(".").next() {
if let Some(ext) = file.rsplit('.').next() {
filename = format!("{}.{}", filename_noext, ext);
path = Some(format!("./tmp/{}.{}", filename_noext, ext));
} else {
@ -565,6 +505,6 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
// HttpResponse::Ok().body("hi")
}
async fn post_health_form(form: HealthForm) -> bool {
async fn post_health_form(_form: HealthForm) -> bool {
todo!()
}