Skip to content

Commit

Permalink
add alcohols to cocktail tags
Browse files Browse the repository at this point in the history
  • Loading branch information
VovaStelmashchuk committed Sep 15, 2024
1 parent 579ceb3 commit 44f7c00
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion features/cocktail/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 44f7c00

Please sign in to comment.