mirror of
https://github.com/zaphar/kitchen.git
synced 2025-07-22 19:40:14 -04:00
Load plan from local_store if http fetch fails
This commit is contained in:
parent
9af13c5bb4
commit
a6a5edcc40
@ -188,13 +188,17 @@ impl StateMachine {
|
||||
}
|
||||
state.recipe_counts = plan_map;
|
||||
} else {
|
||||
// Initialize things to zero
|
||||
if let Some(plan) = local_store.get_plan() {
|
||||
state.recipe_counts = plan.iter().map(|(k, v)| (k.clone(), *v as usize)).collect();
|
||||
} else {
|
||||
// Initialize things to zero.
|
||||
if let Some(rs) = recipe_entries {
|
||||
for r in rs {
|
||||
state.recipe_counts.insert(r.recipe_id().to_owned(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let plan = state
|
||||
.recipe_counts
|
||||
.iter()
|
||||
|
Loading…
x
Reference in New Issue
Block a user