commit: 5ecfecb8c445b3ffe8b2168e9a35dff1a638cae3
parent 94ef845faa8bb79e06e411ed60fc33f9be0d20c9
Author: microlith57 <microlith57@gmail.com>
Date: Sun, 23 Jun 2019 11:48:17 +1200
Fix 'similar ingredients' containing the current ingredient
Signed-off-by: microlith57 <microlith57@gmail.com>
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/templates/ingredient.js b/scripts/templates/ingredient.js
@@ -29,14 +29,15 @@ function IngredientTemplate (id, rect) {
return html
}
- function make_similar (name, recipes) {
+ function make_similar (search_name, recipes) {
var html = ''
var ingredients = find_ingredients(recipes)
- var similar_ingredients = find_similar_ingredients(name, ingredients)
+ var similar_ingredients = find_similar_ingredients(search_name, ingredients)
for (id in similar_ingredients) {
if (similar_ingredients[id][1] < 1) { break }
var name = similar_ingredients[id][0]
+ if (name.toLowerCase() == search_name.toLowerCase()) { continue }
html += `
<li class='ingredient'>
<a onclick="Ø('query').bang('${name}')" href='#${name.to_url()}'>