Skip to content

Commit

Permalink
fix: reduce function for template by metric check
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasFalkowsky committed Jan 23, 2024
1 parent d729ed4 commit 64f5837
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/achievement/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async function getAchievementTemplates(select: TemplateSelectEnum): Promise<Map<
async function getTemplatesByMetrics(metricsForAction: Metric[]) {
const templatesByMetric = await getAchievementTemplates(TemplateSelectEnum.BY_METRIC);
const templateKeys = templatesByMetric ? Array.from(templatesByMetric.keys()) : [];
if (templateKeys.map((key) => templatesByMetric[key]).reduce((all, temp) => [...all, ...temp], 0).length === 0) {
if (templateKeys.map((key) => templatesByMetric[key]).reduce((all, temp) => all.concat(temp), []).length === 0) {
logger.debug(`No achievement templates were found in the database for the metrics: ${metricsForAction.map((m) => `${m.metricName}, `)}`);
return [];
}
Expand Down

0 comments on commit 64f5837

Please sign in to comment.