mirror of
https://github.com/pcvolkmer/osc-variant.git
synced 2025-04-19 19:56:50 +00:00
feat: check for missing form name in for reference (#37)
This commit is contained in:
parent
622811df5a
commit
dbf787d6c9
@ -26,3 +26,9 @@ Dies kann bei wechselseitiger Abhängigkeit zwischen zwei (Unter-)Formularen auf
|
|||||||
|
|
||||||
In diesem Fall kann ein erneuter/zweiter Import helfen, da das Onkostar in diesem Fall alle Formulare importiert hat und
|
In diesem Fall kann ein erneuter/zweiter Import helfen, da das Onkostar in diesem Fall alle Formulare importiert hat und
|
||||||
der Formularverweis dann gespeichert werden kann.
|
der Formularverweis dann gespeichert werden kann.
|
||||||
|
|
||||||
|
### Problem `2024-0005`: Formular hat Formularverweise ohne Angabe des Formulars in den Formularfeldern
|
||||||
|
|
||||||
|
Formularverweise ohne Angabe des Formulars führen zu Problemen bei der Verwendung und Darstellung des entsprechenden
|
||||||
|
Formularverweises.
|
||||||
|
Dieses Problem muss manuell behoben werden.
|
@ -236,6 +236,15 @@ pub fn print_checks() {
|
|||||||
",
|
",
|
||||||
fixable: false,
|
fixable: false,
|
||||||
},
|
},
|
||||||
|
Problem {
|
||||||
|
code: "2024-0005",
|
||||||
|
name: "Formular hat Formularverweise ohne Angabe des Formulars in den Formularfeldern",
|
||||||
|
description: " Formularverweise ohne Angabe des Formulars führen zu Problemen\n \
|
||||||
|
bei der Verwendung und Darstellung des entsprechenden Formularverweises.\n\n \
|
||||||
|
Dieses Problem muss manuell behoben werden.
|
||||||
|
",
|
||||||
|
fixable: false,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
.iter()
|
.iter()
|
||||||
.for_each(|problem| println!("{}\n", problem))
|
.for_each(|problem| println!("{}\n", problem))
|
||||||
|
@ -412,9 +412,38 @@ impl<Type: 'static> FolderContent for Form<Type> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<Type> Form<Type> {
|
||||||
|
fn common_check(&self) -> Vec<CheckNotice> {
|
||||||
|
let missing_forms = self
|
||||||
|
.entries
|
||||||
|
.entry
|
||||||
|
.iter()
|
||||||
|
.filter(|entry| entry.type_ == "formReference" && entry.referenced_data_form.is_none())
|
||||||
|
.map(|entry| format!("'{}'", entry.get_name()))
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
let mut result = vec![];
|
||||||
|
|
||||||
|
if missing_forms.len() > 0 {
|
||||||
|
result.push(ErrorWithCode {
|
||||||
|
code: "2024-0005".to_string(),
|
||||||
|
description: format!(
|
||||||
|
"Formular '{}' hat Formularverweise ohne Angabe des Formulars in: {}",
|
||||||
|
self.name,
|
||||||
|
missing_forms.join(", ")
|
||||||
|
),
|
||||||
|
line: None,
|
||||||
|
example: None,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Checkable for Form<DataFormType> {
|
impl Checkable for Form<DataFormType> {
|
||||||
fn check(&self) -> Vec<CheckNotice> {
|
fn check(&self) -> Vec<CheckNotice> {
|
||||||
if self
|
let mut result = if self
|
||||||
.entries
|
.entries
|
||||||
.entry
|
.entry
|
||||||
.iter()
|
.iter()
|
||||||
@ -422,7 +451,7 @@ impl Checkable for Form<DataFormType> {
|
|||||||
.count()
|
.count()
|
||||||
== 0
|
== 0
|
||||||
{
|
{
|
||||||
return vec![ErrorWithCode {
|
vec![ErrorWithCode {
|
||||||
code: "2023-0002".to_string(),
|
code: "2023-0002".to_string(),
|
||||||
description: format!(
|
description: format!(
|
||||||
"Formular '{}' hat keine Angabe zum Prozedurdatum",
|
"Formular '{}' hat keine Angabe zum Prozedurdatum",
|
||||||
@ -430,16 +459,21 @@ impl Checkable for Form<DataFormType> {
|
|||||||
),
|
),
|
||||||
line: None,
|
line: None,
|
||||||
example: None,
|
example: None,
|
||||||
}];
|
}]
|
||||||
}
|
} else {
|
||||||
vec![]
|
vec![]
|
||||||
|
};
|
||||||
|
|
||||||
|
result.append(&mut self.common_check());
|
||||||
|
|
||||||
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Checkable for Form<UnterformularType> {
|
impl Checkable for Form<UnterformularType> {
|
||||||
fn check(&self) -> Vec<CheckNotice> {
|
fn check(&self) -> Vec<CheckNotice> {
|
||||||
if self.hat_unterformulare {
|
let mut result = if self.hat_unterformulare {
|
||||||
return vec![ErrorWithCode {
|
vec![ErrorWithCode {
|
||||||
code: "2023-0001".to_string(),
|
code: "2023-0001".to_string(),
|
||||||
description: format!(
|
description: format!(
|
||||||
"Unterformular '{}' mit Markierung 'hat Unterformulare'",
|
"Unterformular '{}' mit Markierung 'hat Unterformulare'",
|
||||||
@ -447,10 +481,14 @@ impl Checkable for Form<UnterformularType> {
|
|||||||
),
|
),
|
||||||
line: None,
|
line: None,
|
||||||
example: None,
|
example: None,
|
||||||
}];
|
}]
|
||||||
}
|
} else {
|
||||||
|
vec![]
|
||||||
|
};
|
||||||
|
|
||||||
vec![]
|
result.append(&mut self.common_check());
|
||||||
|
|
||||||
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user