From 1a376e08fc2aa65ddd3ccf4a536f5a4801adc902 Mon Sep 17 00:00:00 2001 From: Mike Shoup Date: Thu, 11 Jul 2019 09:11:41 -0600 Subject: [PATCH] Check if hop is used in boil or front wort hop --- src/humulus/filters.py | 2 ++ tests/test_filters.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/humulus/filters.py b/src/humulus/filters.py index cf178d4..8266739 100644 --- a/src/humulus/filters.py +++ b/src/humulus/filters.py @@ -70,6 +70,8 @@ def recipe_ibu(recipe): bigness = 1.65 * 0.000125**(float(recipe_og(recipe)) - 1) ibu = 0.0 for h in recipe['hops']: + if h['use'] != 'Boil' and h['use'] != 'FWH': + continue mgl = ( float(h['alpha']) * float(h['amount']) * 7490.0 / (float(recipe['volume']) * 100.0) diff --git a/tests/test_filters.py b/tests/test_filters.py index 14ecda5..0dd825f 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -36,7 +36,7 @@ def test_recipe_fg(sample_recipes): def test_recipe_ibu(sample_recipes): - assert recipe_ibu(sample_recipes['lager']) == '26' + assert recipe_ibu(sample_recipes['lager']) == '24' assert recipe_ibu(sample_recipes['sweetstout']) == '34' # Remove hops, verify 0 is returned sample_recipes['lager'].pop('hops') @@ -44,7 +44,7 @@ def test_recipe_ibu(sample_recipes): def test_recipe_ibu_ratio(sample_recipes): - assert recipe_ibu_ratio(sample_recipes['lager']) == '0.48' + assert recipe_ibu_ratio(sample_recipes['lager']) == '0.44' assert recipe_ibu_ratio(sample_recipes['sweetstout']) == '0.89' # Remove fermentables, verify 0 is returned sample_recipes['lager'].pop('fermentables')