From f43761fccdf59d4788d8546cbaa8d741b6478e72 Mon Sep 17 00:00:00 2001
From: TonyFord <tonyford@strategy-investor.de>
Date: Wed, 10 Jun 2020 16:27:52 +0200
Subject: [PATCH] bug fix json search file

---
 search.json | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/search.json b/search.json
index a4c903f..76b2d4d 100644
--- a/search.json
+++ b/search.json
@@ -7,6 +7,7 @@ layout: null
     {% if reg_entry %}
       {% assign reg_entry = reg_entry[0] %}
       {% for o in peer[1] %}
+      {% if notfirstelement %},{% endif %}{% assign notfirstelement = 1 %}
     {
       "headline"    : "{{ o.headline }}",
       "description" : "{{ o.description }}",
@@ -15,11 +16,11 @@ layout: null
       "hid"    : "{{ reg_entry.id | append: o.headline | sha256 | slice: 0,6 }}",
       "price-per-unit" : {{ o.price-per-unit }},
       {% capture priceref %}{{ o.price-reference | split: ',' | join: '-' }}{% endcapture %}
-      {% capture price_ex %}{{ site.data.price-sources[priceref].price | plus: 0.00001 | round: 4 }}{% endcapture %}
+      {% capture price_ex %}{% if site.data.price-sources[priceref] %}{{ site.data.price-sources[priceref].price | plus: 0.00001 | round: 4 }}{% else %}1{% endif %}{% endcapture %}
       {% capture price %}{% if price_ex != "" %}{{price_ex}}{% else %}{{ o.price-source }}{% endif %}{% endcapture %}
       "price-reference" : "{% assign pr = o.price-reference | split: ',' %}{{ pr[1] }}",
       "price" : "{{ o.price-per-unit  | divided_by: price | round: 1 | decimals }}"
-    } {% unless forloop.last %},{% endunless %}
+    }
       {% endfor %}
     {% endif %}
   {% endfor %}
-- 
GitLab