Ejemplo n.º 1
0
    def get_fermentables(self, beerxml: BeerXMLRecipe) -> iter:
        for beerxml_fermentable in beerxml.fermentables:
            amount = beerxml_fermentable.amount
            if amount is not None:
                amount *= 1000  # convert to grams

            name = clean_kind(beerxml_fermentable.name)

            fermentable = RecipeFermentable()
            fermentable.kind_raw = name
            fermentable.amount = amount
            fermentable.form = self.get_fermentable_form(
                beerxml_fermentable.type)
            fermentable.origin_raw = clean_kind(beerxml_fermentable.origin)
            fermentable.color_lovibond = beerxml_fermentable.color
            fermentable._yield = beerxml_fermentable._yield

            yield fermentable
Ejemplo n.º 2
0
    def get_fermentables(self, bs_recipe: BeerSmithNode) -> iter:
        for bs_fermentable in self.get_ingredients_of_type(
                bs_recipe, ['grain']):
            amount = bs_fermentable.float_or_none('amount')
            if amount is not None:
                amount = ounces_to_gramms(amount)

            name = clean_kind(bs_fermentable.string_or_none('name'))

            fermentable = RecipeFermentable()
            fermentable.kind_raw = name
            fermentable.amount = amount
            fermentable.form = self.get_fermentable_form(bs_fermentable)
            fermentable.origin_raw = clean_kind(
                bs_fermentable.string_or_none('origin'))
            fermentable.color_lovibond = bs_fermentable.float_or_none('color')
            fermentable._yield = bs_fermentable.float_or_none('yield')
            fermentable.notes = bs_fermentable.string_or_none('notes')

            yield fermentable