From dacc2e324a8e44e67af4d640fb9ea8c078273df3 Mon Sep 17 00:00:00 2001 From: ItsVipra Date: Sat, 27 May 2023 16:12:51 +0200 Subject: [PATCH 1/5] add amounts for price/100ml, mg/euro --- app/views/drinks/_drink.html.haml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/drinks/_drink.html.haml b/app/views/drinks/_drink.html.haml index 3288d048..45f08c3c 100644 --- a/app/views/drinks/_drink.html.haml +++ b/app/views/drinks/_drink.html.haml @@ -10,3 +10,5 @@ = image_tag drink.logo(:thumb), alt: drink.name, class: drink.active? ? "" : "disabled" .card-footer = show_amount drink.price + = show_amount (drink.price / drink.bottle_size)*100 + = show_amount (drink.caffeine / drink.price) if drink.caffeine From ae61e8bda7b089d413ebd1f7cad36b47a6b636e6 Mon Sep 17 00:00:00 2001 From: ItsVipra Date: Sat, 27 May 2023 17:12:07 +0200 Subject: [PATCH 2/5] fix stuff --- app/views/drinks/_drink.html.haml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/views/drinks/_drink.html.haml b/app/views/drinks/_drink.html.haml index 45f08c3c..00fd5a70 100644 --- a/app/views/drinks/_drink.html.haml +++ b/app/views/drinks/_drink.html.haml @@ -10,5 +10,12 @@ = image_tag drink.logo(:thumb), alt: drink.name, class: drink.active? ? "" : "disabled" .card-footer = show_amount drink.price - = show_amount (drink.price / drink.bottle_size)*100 - = show_amount (drink.caffeine / drink.price) if drink.caffeine + %br + = drink.price / drink.bottle_size + €/L + %br + - if drink.caffeine && !drink.caffeine.zero? + = sprintf('%.2f', (drink.caffeine / drink.price)) + mg caffeine/€ + - else + ??? mg caffeine/€ From b082d49220a069a1fd7ce3a250c430f8a8341bc3 Mon Sep 17 00:00:00 2001 From: Niklas Sombert Date: Fri, 20 Oct 2023 19:10:59 +0200 Subject: [PATCH 3/5] :bug: Fix caffeine calculation --- app/views/drinks/_drink.html.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/drinks/_drink.html.haml b/app/views/drinks/_drink.html.haml index 00fd5a70..a28ad054 100644 --- a/app/views/drinks/_drink.html.haml +++ b/app/views/drinks/_drink.html.haml @@ -14,8 +14,8 @@ = drink.price / drink.bottle_size €/L %br - - if drink.caffeine && !drink.caffeine.zero? - = sprintf('%.2f', (drink.caffeine / drink.price)) + - if drink.caffeine && !drink.caffeine.zero? && drink.bottle_size && !drink.bottle_size.zero? + = sprintf('%.2f', (drink.caffeine * (drink.bottle_size / 0.1) / drink.price)) mg caffeine/€ - else - ??? mg caffeine/€ + no caffeine From d19710801058179cca70a84d0c6df1e6b3be46c8 Mon Sep 17 00:00:00 2001 From: Niklas Sombert Date: Fri, 20 Oct 2023 20:10:05 +0200 Subject: [PATCH 4/5] :bug: Hide infinity price --- app/views/drinks/_drink.html.haml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/views/drinks/_drink.html.haml b/app/views/drinks/_drink.html.haml index a28ad054..1546d1df 100644 --- a/app/views/drinks/_drink.html.haml +++ b/app/views/drinks/_drink.html.haml @@ -11,8 +11,11 @@ .card-footer = show_amount drink.price %br - = drink.price / drink.bottle_size - €/L + - if drink.bottle_size? + = drink.price / drink.bottle_size + €/L + - else + %br - if drink.caffeine && !drink.caffeine.zero? && drink.bottle_size && !drink.bottle_size.zero? = sprintf('%.2f', (drink.caffeine * (drink.bottle_size / 0.1) / drink.price)) From 4149811441f9a31fb92343cdb8d0114e6707ce95 Mon Sep 17 00:00:00 2001 From: Niklas Sombert Date: Fri, 20 Oct 2023 20:12:10 +0200 Subject: [PATCH 5/5] =?UTF-8?q?:speech=5Fballoon:=20Replace=20EUR=20with?= =?UTF-8?q?=20=E2=82=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a89ff3d1..a56c2b44 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -8,7 +8,7 @@ def get_revision def show_amount(price) return 'n/a' if price.blank? - sprintf('%.2f EUR', price) + sprintf('%.2f €', price) end def link_to_drink_if_exists(drink)