added some comments

This commit is contained in:
Timo Volkmann 2020-06-19 15:38:15 +02:00
parent d92c164127
commit 5ee6cc7a82

View File

@ -34,9 +34,11 @@ function searchHandler(dbConn) {
headers: req.headers
}
// SWITCH TO SUPPORT OLD AND NEW BASE64 BASED QUERY SYNTAX
let q = req.query.q ? base64.base64ToObj(req.query.q) : req.query
console.log('Q:', q)
// CHOOSE PARAMS WHICH SHALL BE PASSED TO SCORE AND SEARCH
let scoreQueryObj = {}
if (q.temperature) scoreQueryObj['temperature_mean_max'] = q.temperature
if (q.temperature_mean_max) scoreQueryObj['temperature_mean_max'] = q.temperature_mean_max
@ -52,11 +54,6 @@ function searchHandler(dbConn) {
if (q.entertainment_costs) scoreQueryObj['entertainment_costs'] = q.entertainment_costs
if (q.average_per_day_costs) scoreQueryObj['average_per_day_costs'] = q.average_per_day_costs
//console.log(scoreQueryObj)
// if (_.isEmpty(scoreQueryObj)) {
// res.status(400).send('provide at least one search parameter.');
// }
scoreAndSearch(q.from, q.to, scoreQueryObj).then(searchResults => {
//response.data = searchResults