chore: rustfmt run

This commit is contained in:
alphafetus committed 2026-02-10 09:39:30 -05:00
1 parent 1abedae760
commit 12dfe502f4
7 files changed
+117 -102

No files matched your search

+2 -8
View File
@@ -136,14 +136,8 @@ fn StudentRoutes() -> impl MatchNestedRoutes + Clone {
path=path!("additional/work-experience") path=path!("additional/work-experience")
view=student::StudentWorkExperiencePage view=student::StudentWorkExperiencePage
/> />
<Route <Route path=path!("additional/university") view=student::StudentUniversityPage />
path=path!("additional/university") <Route path=path!("additional/family-info") view=student::StudentFamilyPage />
view=student::StudentUniversityPage
/>
<Route
path=path!("additional/family-info")
view=student::StudentFamilyPage
/>
</ParentRoute> </ParentRoute>
} }
.into_inner() .into_inner()
+47 -37
View File
@@ -36,60 +36,70 @@ impl InputType {
) -> impl IntoView { ) -> impl IntoView {
view! { view! {
{match self { {match self {
InputType::Text(member, label, placeholder, required) => InputType::Text(member, label, placeholder, required) => {
view! { view! {
<Row> <Row>
<OutlinedTextField <OutlinedTextField
label = label.clone() label=label.clone()
placeholder = placeholder.clone() placeholder=placeholder.clone()
data_member = member.clone() data_member=member.clone()
data_map = data_map data_map=data_map
required = required required=required
/> />
</Row> </Row>
}.into_any(), }
InputType::Number(member, label, placeholder, required) => .into_any()
}
InputType::Number(member, label, placeholder, required) => {
view! { view! {
<OutlinedTextField <OutlinedTextField
label = label.clone() label=label.clone()
placeholder = placeholder.clone() placeholder=placeholder.clone()
data_member = member.clone() data_member=member.clone()
data_map = data_map data_map=data_map
input_type = TextFieldType::Number input_type=TextFieldType::Number
required = required required=required
/> />
}.into_any(), }
InputType::Checkbox(member, label, options, required) => .into_any()
}
InputType::Checkbox(member, label, options, required) => {
view! { view! {
<CheckboxList <CheckboxList
label = label.clone() label=label.clone()
name = name.clone() name=name.clone()
items = options.clone() items=options.clone()
data_member = member.clone() data_member=member.clone()
data_map = data_map data_map=data_map
required = required required=required
/> />
}.into_any(), }
InputType::Radio(member, label, options, required) => .into_any()
}
InputType::Radio(member, label, options, required) => {
view! { view! {
<RadioList <RadioList
label = label.clone() label=label.clone()
data_member = member.clone() data_member=member.clone()
data_map = data_map data_map=data_map
items = options.clone() items=options.clone()
required = required required=required
/> />
}.into_any(), }
InputType::Select(member, label, options, required) => .into_any()
}
InputType::Select(member, label, options, required) => {
view! { view! {
<Select <Select
label = label.clone() label=label.clone()
value_list = options.clone() value_list=options.clone()
data_member = member.clone() data_member=member.clone()
data_map = data_map data_map=data_map
required = required required=required
/> />
}.into_any() }
.into_any()
}
}} }}
} }
} }
+2 -6
View File
@@ -4,12 +4,8 @@ use leptos::prelude::*;
pub fn AdminScholarshipPage() -> impl IntoView { pub fn AdminScholarshipPage() -> impl IntoView {
view! { view! {
<div class="flex flex-1 flex-col gap-4"> <div class="flex flex-1 flex-col gap-4">
<div class="font-bold text-3xl"> <div class="font-bold text-3xl">"Scholarships View"</div>
"Scholarships View" <div>"This is a placeholder for now. It will show a list of all scholarships."</div>
</div>
<div>
"This is a placeholder for now. It will show a list of all scholarships."
</div>
</div> </div>
} }
} }
+1 -4
View File
@@ -7,10 +7,7 @@ pub fn StudentAcademicsPage() -> impl IntoView {
let controller = use_student_form("academics"); let controller = use_student_form("academics");
view! { view! {
<Show <Show when=move || controller.data_resource.get().is_some() fallback=Loading>
when=move || controller.data_resource.get().is_some()
fallback=Loading
>
<div class="flex flex-1" /> <div class="flex flex-1" />
<div class="flex flex-col flex-2 mt-6"> <div class="flex flex-col flex-2 mt-6">
<ValidatedForm title="Academic Information" on_submit=controller.submit_action> <ValidatedForm title="Academic Information" on_submit=controller.submit_action>
+1 -4
View File
@@ -8,10 +8,7 @@ pub fn StudentAthleticsPage() -> impl IntoView {
let controller = use_student_form("athletics"); let controller = use_student_form("athletics");
view! { view! {
<Show <Show when=move || controller.data_resource.get().is_some() fallback=Loading>
when=move || controller.data_resource.get().is_some()
fallback=Loading
>
<div class="flex flex-1" /> <div class="flex flex-1" />
<div class="flex flex-col flex-2 mt-6"> <div class="flex flex-col flex-2 mt-6">
<ValidatedForm title="Athletics Information" on_submit=controller.submit_action> <ValidatedForm title="Athletics Information" on_submit=controller.submit_action>
+62 -41
View File
@@ -60,53 +60,69 @@ pub fn StudentEligibilityPage() -> impl IntoView {
let Some(Ok(student_info)) = student_resource.get() else { let Some(Ok(student_info)) = student_resource.get() else {
return view! {}.into_any(); return view! {}.into_any();
}; };
let valid_list = scholarships_list
let valid_list = scholarships_list.iter() .iter()
.filter_map(|scholarship| { .filter_map(|scholarship| {
let scholarship_name = scholarship.data.get("name") let scholarship_name = scholarship
.unwrap_or(&ValueType::String(None)) .data
.as_string().ok().flatten().unwrap_or_default(); .get("name")
.unwrap_or(&ValueType::String(None))
.as_string()
.ok()
.flatten()
.unwrap_or_default();
debug_log!("Checking scholarship: {}", scholarship_name); debug_log!("Checking scholarship: {}", scholarship_name);
let requirements_map = scholarship
// Each scholarship will return Some(itself), or None. This is will be automatically .data
// filtered based on the information. Invalid scholarships are None, along with those .get("requirements")
// that fail validation for any reason. Scholarships that are valid or did not choose
// any requirements are Some(scholarship).
let requirements_map = scholarship.data.get("requirements")
.unwrap_or(&ValueType::Map(None)) .unwrap_or(&ValueType::Map(None))
.as_map().ok().flatten() .as_map()
.ok()
.flatten()
.unwrap_or_default() .unwrap_or_default()
.values().cloned() .values()
.cloned()
.collect::<Vec<ValueType>>(); .collect::<Vec<ValueType>>();
let resolved_requirements = requirements_map let resolved_requirements = requirements_map
.iter() .iter()
.map(|list_val| { .map(|list_val| {
// We want to cast to a list, and then map the list to a new let list = list_val
// one that contains the correct ComparisonData. .as_list()
let list = list_val.as_list().ok().flatten().unwrap_or_default(); .ok()
list.iter().filter_map(|v| { .flatten()
let id_string = v.as_string().ok().flatten().unwrap_or_default(); .unwrap_or_default();
relations_list.iter() list.iter()
.find(|relation| relation.id == id_string) .filter_map(|v| {
}) let id_string = v
.cloned() .as_string()
.collect::<Vec<ComparisonData>>() .ok()
.flatten()
.unwrap_or_default();
relations_list
.iter()
.find(|relation| relation.id == id_string)
})
.cloned()
.collect::<Vec<ComparisonData>>()
}) })
.collect::<Vec<Vec<ComparisonData>>>(); .collect::<Vec<Vec<ComparisonData>>>();
debug_log!(
debug_log!("Resolved requirements: {:?}", resolved_requirements.iter().flatten().map(|rel| rel.display_text.clone()).collect::<Vec<String>>()); "Resolved requirements: {:?}", resolved_requirements.iter().flatten().map(|rel| rel.display_text.clone()).collect::<Vec<String>>()
);
let valid = resolved_requirements.iter() let valid = resolved_requirements
.iter()
.all(|list| { .all(|list| {
list.iter().fold(false, |prev, requirement| { list.iter()
let result = requirement.compare(&student_info) .fold(
.unwrap_or(false); false,
|prev, requirement| {
if prev { prev } else { result } let result = requirement
}) .compare(&student_info)
.unwrap_or(false);
if prev { prev } else { result }
},
)
}); });
if valid { if valid {
debug_log!("Scholarship is valid."); debug_log!("Scholarship is valid.");
Some(scholarship.clone()) Some(scholarship.clone())
@@ -116,15 +132,19 @@ pub fn StudentEligibilityPage() -> impl IntoView {
}) })
.collect::<Vec<ExpandableInfo>>(); .collect::<Vec<ExpandableInfo>>();
// Each scholarship will return Some(itself), or None. This is will be automatically
// filtered based on the information. Invalid scholarships are None, along with those
// that fail validation for any reason. Scholarships that are valid or did not choose
// any requirements are Some(scholarship).
// We want to cast to a list, and then map the list to a new
// one that contains the correct ComparisonData.
view! { view! {
<div>{format!("Valid scholarships: {}", valid_list.len())}</div> <div>{format!("Valid scholarships: {}", valid_list.len())}</div>
<For <For
each=move || valid_list.clone() each=move || valid_list.clone()
key=|scholarship| { key=|scholarship| { scholarship.subject.clone() }
scholarship
.subject
.clone()
}
children=move |scholarship| { children=move |scholarship| {
let scholarship = StoredValue::new(scholarship); let scholarship = StoredValue::new(scholarship);
let scholarship_name = Memo::new(move |_| { let scholarship_name = Memo::new(move |_| {
@@ -163,7 +183,8 @@ pub fn StudentEligibilityPage() -> impl IntoView {
} }
} }
/> />
}.into_any() }
.into_any()
}} }}
</Suspense> </Suspense>
</div> </div>
+2 -2
View File
@@ -15,7 +15,7 @@ pub fn StudentShell() -> impl IntoView {
title="R15 Student Scholarship Application" title="R15 Student Scholarship Application"
logo="/PHS_Stacked_Acronym.png" logo="/PHS_Stacked_Acronym.png"
/> />
<div class="flex flex-1 min-h-0"> <div class="flex flex-1 min-h-0">
<AuthLoaded fallback=Loading> <AuthLoaded fallback=Loading>
<Authenticated unauthenticated=UnauthenticatedPage> <Authenticated unauthenticated=UnauthenticatedPage>
@@ -38,7 +38,7 @@ pub fn StudentShell() -> impl IntoView {
], ],
), ),
), ),
TabInfo::new("Eligible Scholarships", "eligibility", None) TabInfo::new("Eligible Scholarships", "eligibility", None),
] ]
/> />
</Authenticated> </Authenticated>