add more diff to recipe list
This commit is contained in:
parent
9bf4c508cd
commit
8cf4d596f5
1 changed files with 43 additions and 9 deletions
|
|
@ -16,13 +16,6 @@ macro_rules! compare_field {
|
|||
if $self.$field != $another_setting.$field {
|
||||
$list.push(stringify!($field).to_string());
|
||||
}
|
||||
println!(
|
||||
"check {}, {} | {:#?} != {:#?}",
|
||||
stringify!($field).to_string(),
|
||||
$self.$field != $another_setting.$field,
|
||||
$self.$field,
|
||||
$another_setting.$field
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -899,7 +892,28 @@ impl Recipe01Trait for Recipe01 {
|
|||
compare_field!(self, another_recipe01, list, otherDescription);
|
||||
compare_field!(self, another_recipe01, list, otherName);
|
||||
compare_field!(self, another_recipe01, list, productCode);
|
||||
compare_field!(self, another_recipe01, list, recipes);
|
||||
|
||||
if self.recipes.len().eq(&another_recipe01.recipes.len()) {
|
||||
for ri in 0..self.recipes.len() {
|
||||
let repl_diff = self
|
||||
.recipes
|
||||
.get(ri)
|
||||
.unwrap()
|
||||
.compare(another_recipe01.recipes.get(ri).unwrap());
|
||||
let mut current_diff = repl_diff
|
||||
.iter()
|
||||
.map(|x| format!("recipes.{ri}.{x}").to_string())
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
if current_diff.len() > 0 {
|
||||
list.append(&mut current_diff);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
list.push("recipes".to_string());
|
||||
// diff by size
|
||||
}
|
||||
|
||||
compare_field!(self, another_recipe01, list, SubMenu);
|
||||
compare_field!(self, another_recipe01, list, ToppingSet);
|
||||
compare_field!(self, another_recipe01, list, total_time);
|
||||
|
|
@ -1470,10 +1484,30 @@ impl RecipeList {
|
|||
|
||||
// grep data fn
|
||||
pub fn get_data_used_in_brew(&mut self) -> Value {
|
||||
if (self.isUse) {}
|
||||
if self.isUse {}
|
||||
|
||||
Value::Null
|
||||
}
|
||||
|
||||
pub fn compare(&self, another_recipe_list: &RecipeList) -> Vec<String> {
|
||||
let mut diff_list = Vec::new();
|
||||
compare_field!(self, another_recipe_list, diff_list, MixOrder);
|
||||
compare_field!(self, another_recipe_list, diff_list, StringParam);
|
||||
compare_field!(self, another_recipe_list, diff_list, FeedParameter);
|
||||
compare_field!(self, another_recipe_list, diff_list, FeedPattern);
|
||||
compare_field!(self, another_recipe_list, diff_list, isUse);
|
||||
compare_field!(self, another_recipe_list, diff_list, materialPathId);
|
||||
compare_field!(self, another_recipe_list, diff_list, powderGram);
|
||||
compare_field!(self, another_recipe_list, diff_list, powderTime);
|
||||
compare_field!(self, another_recipe_list, diff_list, stirTime);
|
||||
compare_field!(self, another_recipe_list, diff_list, syrupGram);
|
||||
compare_field!(self, another_recipe_list, diff_list, syrupTime);
|
||||
compare_field!(self, another_recipe_list, diff_list, waterCold);
|
||||
compare_field!(self, another_recipe_list, diff_list, waterYield);
|
||||
compare_field!(self, another_recipe_list, diff_list, extra);
|
||||
|
||||
diff_list
|
||||
}
|
||||
}
|
||||
|
||||
/// The above code defines a Rust struct called MaterialSetting with various fields representing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue