From 81f115702733e7355aa034f4ab34bb1e723fdb47 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 28 Oct 2022 01:23:41 +0300 Subject: [PATCH] Update update.js --- scripts/commands/guides/update.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/scripts/commands/guides/update.js b/scripts/commands/guides/update.js index 37e82df9..55841a53 100644 --- a/scripts/commands/guides/update.js +++ b/scripts/commands/guides/update.js @@ -158,20 +158,19 @@ function getChannelPrograms(programs) { } function calcPriority(programs) { - let priority = 0 - for (let program of programs) { - for (let prop in program) { - let value = program[prop] + return programs.reduce((total, program) => { + let values = Object.values(program) + for (let value of values) { if (Array.isArray(value) && value.length) { - priority++ + total++ } else if (typeof value === 'string' && value) { - priority++ + total++ } else if (value && typeof value === 'object' && Object.values(value).map(Boolean).length) { - priority++ + total++ } } - } - return priority + return total + }, 0) }