From 4e5aab323e7bee219fde9dd1473125715856c493 Mon Sep 17 00:00:00 2001 From: artus40 Date: Fri, 15 Feb 2019 14:18:17 +0100 Subject: [PATCH] small fixes --- planner/src/solver.rs | 8 ++++---- web/src/main.rs | 7 ++----- web/vue/src/components/Planner.vue | 3 +-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/planner/src/solver.rs b/planner/src/solver.rs index ebc3ca9..58eecf2 100644 --- a/planner/src/solver.rs +++ b/planner/src/solver.rs @@ -222,15 +222,15 @@ impl<'a, V, K: Eq + Hash + Clone> Problem<'a, V, K> { } /// Returns all complete solutions, after visiting all possible outcomes using a stack (DFS). pub fn solve_all(&mut self) -> Vec> - where V: Clone + fmt::Debug, - K: Clone + fmt::Debug, + where V: fmt::Debug, + K: fmt::Debug, { self._solve(None) // No limit } pub fn solve_one(&mut self) -> Option> - where V: Clone + fmt::Debug, - K: Clone + fmt::Debug, + where V: fmt::Debug, + K: fmt::Debug, { self._solve(Some(1)).pop() } diff --git a/web/src/main.rs b/web/src/main.rs index 1542f60..99c548f 100644 --- a/web/src/main.rs +++ b/web/src/main.rs @@ -127,8 +127,6 @@ mod api { solver::{Domain, Problem} }; - println!("{:?}", partial); - println!("Building problem"); let possible_values = recipes::load_all(&conn); let domain = Domain::new(possible_values); let mut problem = Problem::build(); @@ -144,16 +142,15 @@ mod api { && slot.key.1 == format!("{:?}",var.1) { let id = slot.value.as_ref().unwrap().id; - println!("found initial : recipe with id {}", id); + //println!("found initial : recipe with id {}", id); Some(id) } else { None } }); let ini = if let Some(id) = initial_id { - // Not working because we're capturing `id` let new_ini = domain.find(|r| {r.id == id}); - println!("Overrided {:?}", new_ini); + //println!("Overrided {:?}", new_ini); new_ini } else { ini diff --git a/web/vue/src/components/Planner.vue b/web/vue/src/components/Planner.vue index beee6fd..18157c5 100644 --- a/web/vue/src/components/Planner.vue +++ b/web/vue/src/components/Planner.vue @@ -120,12 +120,11 @@ export default { body, }) .then((res) => { - this.is_loading = false; return res.json();} ) .then((data) => this.template.updateJson(data)) .catch((err) => console.error(err)); - + this.is_loading = false; }, unsetMeal: function(mealKey) { let idx = this.template.findIndexByKey(mealKey);