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

@ -70,270 +70,204 @@ pub async fn mt_form(MultipartForm(form): MultipartForm<MtForm>) -> HttpResponse
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 email_subject = format!("{} {} signed up for mission trip!", 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 gender = form
.gender
.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: 0 }).0.clone();
let zip = form.zip.as_ref().unwrap_or(&Text(0)).0;
let cellphone = form
.cellphone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let parentphone = form
.parentphone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let email = form
.email
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let parentemail = form
.parentemail
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let school = form
.school
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let grade = form
.grade
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let pastor = format!(
"{} {}",
form.pastor_first_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone(),
form.pastor_last_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.unwrap_or(&Text(String::from("")))
.0
.clone()
);
let church_attendance = form
.church_attendance
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let tfc_group = form
.tfc_group
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let shirt = form
.shirt
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let trip = form
.trip
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let trip_notes = form
.trip_notes
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let relationship = form
.relationship_with_jesus
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let testimony = form
.testimony
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let involvement = form
.involvement_with_group
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let reasons = form
.reasons
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let strengths = form
.strengths
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let weaknesses = form
.weaknesses
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let previous_trip = form
.previous_trip_info
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let attitude = form
.attitude
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let relevant = form
.relevant_notes
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let final_agreement = form
.final_agreement
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let registration = form
.registration
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
log::info!("{first} {last} signed up for mission trip!");
@ -489,7 +423,7 @@ pub async fn mt_form(MultipartForm(form): MultipartForm<MtForm>) -> HttpResponse
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 {