diff --git a/_includes/fairex-orders.html b/_includes/fairex-orders.html index 5836532033ff111fa233cb008f66be4e59618152..a7db6cd5b801caa79268034b594d509449fa2b65 100644 --- a/_includes/fairex-orders.html +++ b/_includes/fairex-orders.html @@ -18,7 +18,7 @@ {% endfor %}</small><br> <div><small>{{ o.description }}</small></div> </div> - {% capture priceref %}{{ o.price-reference[0] | join: '-' }}{% endcapture %} + {% capture priceref %}{{ o.price-reference | join: '-' }}{% endcapture %} {% capture price_ex %} {% if site.data.price-sources[priceref] != null %} {{ site.data.price-sources[priceref].price | plus: 0.00001 | round: 4 }} @@ -39,7 +39,7 @@ {% endcapture %} <div class="orderlist-price"> - {% if o.min-size > 0 %}{{ o.min-size }}..{% endif %}{{ o.max-size }} {{ o.price-reference[0][0] }} ( {{ pricelimit | times: o.max-size | decimals }} {{ o.price-reference[0][1] }} ) <font class="faircoin-price">{{ pricelimit | decimals }} {{ o.price-reference[0][1] }}</font><br><span class="fairex">{% if price_ex > 0 %}<i>( <a href="{{ site.data.price-sources[priceref].www }}">{{ priceref }}</a> {{ price }} {{ site.data.price-sources[priceref].currency }} / {{ o.price-reference[0][0] }} )<br>{% else %}<i>fixed price{% endif %}</i></span> + {% if o.min-size > 0 %}{{ o.min-size }}..{% endif %}{{ o.max-size }} {{ o.price-reference[0] }} ( {{ pricelimit | times: o.max-size | decimals }} {{ o.price-reference[1] }} ) <font class="faircoin-price">{{ pricelimit | decimals }} {{ o.price-reference[1] }}</font><br><span class="fairex">{% if price_ex > 0 %}<i>( <a href="{{ site.data.price-sources[priceref].www }}">{{ priceref }}</a> {{ price }} {{ site.data.price-sources[priceref].currency }} / {{ o.price-reference[0] }} )<br>{% else %}<i>fixed price{% endif %}</i></span> </div> </div> diff --git a/_includes/overview.html b/_includes/overview.html index 0c468ab84d4e49bd78cf0c5166adf2ede76dc84c..8c46203e8fc1a93c1449442808e0ace968cf213e 100644 --- a/_includes/overview.html +++ b/_includes/overview.html @@ -60,7 +60,7 @@ {% endfor %}</small><br> <div><small>{{ o.description }}</small></div> </div> - {% capture priceref %}{{ o.price-reference[0] | join: '-' }}{% endcapture %} + {% capture priceref %}{{ o.price-reference | join: '-' }}{% endcapture %} {% capture price_ex %}{{ site.data.price-sources[priceref].price | plus: 0.00001 | round: 4 }}{% endcapture %} {% capture price %}{% if price_ex != "" %}{{price_ex}}{% else %}{{ o.price-source }}{% endif %}{% endcapture %} <div class="orderlist-price"><font class="faircoin-price">{{ o.price-per-unit | divided_by: price | round:1 | decimals }} FAIR</font><br>{% if o.min-size > 0 %}{{ o.min-size }}..{% endif %}{{ o.max-size }} {{ o.unit }}<br>( {{ o.price-per-unit | decimals }} {{ site.data.price-sources[priceref].currency }} / {{ o.unit }} )<br>( {{ price }} {{ site.data.price-sources[priceref].currency }} / FAIR )<br><i>{% if price_ex != "" %}<a href="{{ site.data.price-sources[o.price-source].www }}">{{ o.price-source | replace: '-','/' }}</a>{% else %}fixed price{% endif %}</i> diff --git a/assets/js/script.js b/assets/js/script.js index fb4b9a7380dd56ef8311a5ae542191dd54bdb00b..d4b4ecae1cf3b89c69bce650aa55f0cf0186e3e6 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -80,12 +80,7 @@ function getByTag( tags, is_active ){ },100 ); },500 ); - - } - - - } function getDistancesTags(){ @@ -127,9 +122,9 @@ function createYml(){ var yml=''; $.each( $('.order-form'), function(i,v){ - if( v.id == 'price-reference' ){ - yml+=v.id + ':\n- [ ' + $(v).val().replace(/(?:\r\n|\r|\n)/g, '<br>') + ' ]\n'; - } else { + if( v.id == 'price-reference' || v.id == 'tags' ){ + yml+=v.id + ': [ ' + $(v).val().replace(/(?:\r\n|\r|\n)/g, '<br>') + ' ]\n'; + } else { yml+=v.id + ': ' + $(v).val().replace(/(?:\r\n|\r|\n)/g, '<br>') + '\n'; } diff --git a/script/get_orders.py b/script/get_orders.py index 116ffe6e82685f3dcdf45eaf007e0780a1978d31..2759c4cd3a421602bb0ba350690d7738b37db8dd 100644 --- a/script/get_orders.py +++ b/script/get_orders.py @@ -65,7 +65,6 @@ file = open('../_data/language-codes.yml','r') s=file.read() file.close() Language_codes=load( s, Loader=Loader ) -print( Language_codes ) file = open('../_data/form.yml','r') s=file.read() @@ -142,10 +141,11 @@ for source in Pulls: continue else: if( len(OO['tags']) > 0 and len(OO['tags']) < 4 ): - if not os.path.exists('../_data/categories/'+(OO['tags'][0]).strip()+'.yml' ) and not os.path.exists('../_data/categories/ex/'+(OO['tags'][0]).strip()+'.yml' ): + if not os.path.exists('../_data/categories/'+(OO['tags'][0]).strip()+'.yml' ) and not os.path.exists('../_data/categories/fairex/'+(OO['tags'][0]).strip()+'.yml' ): logme('- order.yml[tags] = "'+(OO['tags'][0]).strip()+'" not found -> SKIP order !') continue else: + logme('- order.yml[tags] bad array length = ' + len(OO['tags']) + ' ( should be 1 or 2 or 3 )-> SKIP order !') continue @@ -234,30 +234,30 @@ for source in Pulls: continue else: ps=False - for p in OO['price-reference']: - if( len(p) != 3 ): - logme('- order.yml[price-reference] requires array with length 3 but is '+str( len(p) )+' -> SKIP price-reference !') + p=OO['price-reference'] + if( len(p) != 3 ): + logme('- order.yml[price-reference] requires array with length 3 but is '+str( len(p) )+' -> SKIP price-reference !') + continue + else: + if not os.path.exists('../_data/currencies/'+(p[0]).strip()+'.yml' ): + logme('- order.yml[price-reference] = '+(p[0]).strip()+'.yml not found in _data/currencies -> SKIP price-reference !') continue else: - if not os.path.exists('../_data/currencies/'+(p[0]).strip()+'.yml' ): - logme('- order.yml[price-reference] = '+(p[0]).strip()+'.yml not found in _data/currencies -> SKIP price-reference !') + file = open('../_data/currencies/'+p[0].strip()+'.yml','r') + s=file.read() + file.close() + P=load( s, Loader=Loader ) + + if( p[1].strip() not in P['price-sources'] ): + logme('- order.yml[price-reference] = '+(p[0]).strip()+'.yml[price-reference]['+p[1].strip()+']not found in _data/currencies -> SKIP price-reference !') continue else: - file = open('../_data/currencies/'+p[0].strip()+'.yml','r') - s=file.read() - file.close() - P=load( s, Loader=Loader ) - - if( p[1].strip() not in P['price-sources'] ): - logme('- order.yml[price-reference] = '+(p[0]).strip()+'.yml[price-reference]['+p[1].strip()+']not found in _data/currencies -> SKIP price-reference !') + if( p[2].strip() not in P['price-sources'][p[1].strip()] ): + logme('- order.yml[price-reference] = '+(p[0]).strip()+'.yml[price-reference]['+p[1].strip()+']['+p[2].strip()+'] not found in _data/currencies -> SKIP price-reference !') continue else: - if( p[2].strip() not in P['price-sources'][p[1].strip()] ): - logme('- order.yml[price-reference] = '+(p[0]).strip()+'.yml[price-reference]['+p[1].strip()+']['+p[2].strip()+'] not found in _data/currencies -> SKIP price-reference !') - continue - else: - # OO['price-currency']=P['price-sources'][p[1].strip()]['currency'] - ps=True + # OO['price-currency']=P['price-sources'][p[1].strip()]['currency'] + ps=True if( ps == False ): logme('- order.yml[price-reference] all sources invalid -> SKIP order !')