From 44f7c002d021112eb8ca1e0a3260c979366f2569 Mon Sep 17 00:00:00 2001 From: vovastelmashchuk Date: Sun, 15 Sep 2024 19:11:33 +0300 Subject: [PATCH] add alcohols to cocktail tags --- features/cocktail/utils.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/features/cocktail/utils.js b/features/cocktail/utils.js index 27605cb..399056e 100644 --- a/features/cocktail/utils.js +++ b/features/cocktail/utils.js @@ -50,6 +50,12 @@ async function getFullCocktailBySlug(slug) { slug: tag.slug })) + const alcohols = cocktail.alcohols?.map(alcohol => ({ + name: alcohol.name, + url: `alcohol=${alcohol.slug}`, + slug: alcohol.slug + })) || []; + let ratting = cocktail.ratingCount ? cocktail.ratingValue / cocktail.ratingCount : 0; if (ratting === 0) { ratting = null; @@ -82,10 +88,11 @@ async function getFullCocktailBySlug(slug) { images: cocktailImages, goods: goods, tools: glassware.concat(tools), - tags: taste.concat(tags), + tags: taste.concat(tags).concat(alcohols), article: article, }; } catch (error) { + console.error(error); return null; } }