1
0
mirror of https://github.com/pcvolkmer/osc-variant.git synced 2025-04-19 19:56:50 +00:00

refactor: rename functions

This commit is contained in:
Paul-Christian Volkmer 2024-11-09 12:27:55 +01:00
parent 95ba080875
commit 7a0748bc55

View File

@ -212,7 +212,7 @@ impl OnkostarEditor {
} }
pub fn fix(mut self) -> Self { pub fn fix(mut self) -> Self {
fn has_error1(form: &Form<UnterformularType>, error_code: &str) -> bool { fn has_unterformular_error(form: &Form<UnterformularType>, error_code: &str) -> bool {
form.check() form.check()
.iter() .iter()
.filter(|&check_notice| match check_notice { .filter(|&check_notice| match check_notice {
@ -223,7 +223,7 @@ impl OnkostarEditor {
> 0 > 0
} }
fn has_error2(form: &Form<DataFormType>, error_code: &str) -> bool { fn has_dataform_error(form: &Form<DataFormType>, error_code: &str) -> bool {
form.check() form.check()
.iter() .iter()
.filter(|&check_notice| match check_notice { .filter(|&check_notice| match check_notice {
@ -237,24 +237,24 @@ impl OnkostarEditor {
self.editor self.editor
.data_form .data_form
.iter_mut() .iter_mut()
.filter(|form| has_error2(form, "2023-0002")) .filter(|form| has_dataform_error(form, "2023-0002"))
.map(|form| form.to_unterformular()) .map(|form| form.to_unterformular())
.for_each(|form| self.editor.unterformular.push(form)); .for_each(|form| self.editor.unterformular.push(form));
self.editor self.editor
.unterformular .unterformular
.iter_mut() .iter_mut()
.filter(|form| has_error1(form, "2023-0001")) .filter(|form| has_unterformular_error(form, "2023-0001"))
.map(|form| form.to_dataform()) .map(|form| form.to_dataform())
.for_each(|form| self.editor.data_form.push(form)); .for_each(|form| self.editor.data_form.push(form));
self.editor self.editor
.data_form .data_form
.retain(|form| !has_error2(form, "2023-0002")); .retain(|form| !has_dataform_error(form, "2023-0002"));
self.editor self.editor
.unterformular .unterformular
.retain(|form| !has_error1(form, "2023-0001")); .retain(|form| !has_unterformular_error(form, "2023-0001"));
// Sort forms by requirements // Sort forms by requirements
self.editor self.editor