From 7a6be53e0b753f3c2536eca3cf37f8651918c1f5 Mon Sep 17 00:00:00 2001 From: Timo John Date: Thu, 25 Jun 2020 15:15:04 +0200 Subject: [PATCH] hotfix: search handles null values instead of arrays full of nulls --- backend/util/scoreAndSearch.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/util/scoreAndSearch.js b/backend/util/scoreAndSearch.js index 14ba8c2..f0a486e 100644 --- a/backend/util/scoreAndSearch.js +++ b/backend/util/scoreAndSearch.js @@ -202,10 +202,10 @@ function createPeriod(from, to, currentMonth, currentYear) { function calculateScoreForPeriod(type, travelPeriods, region, searchLowParam, searchMaxParam) { // console.log('getScoreAndAverageFromClimate for', region.name, type) - const singleScores = travelPeriods.map(period => { + const singleScores = travelPeriods. map(period => { let res = { type: type, - value: region[type][period.month - 1], + value: region[type] !== null ? region[type][period.month - 1] : null, days: period.days }