Changed Temp from mean to mean_max
Changed parameters to temperature_mean_max set database formatting to utf8 add .env to .gitignore added .env.sample .gitignore fix
This commit is contained in:
parent
e670b40d1c
commit
24971248c9
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
||||
# credentials
|
||||
.env
|
||||
|
||||
# compiled output
|
||||
/dist
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
-- Exportiere Datenbank Struktur für travopti
|
||||
DROP DATABASE IF EXISTS `travopti`;
|
||||
CREATE DATABASE IF NOT EXISTS `travopti` /*!40100 DEFAULT CHARACTER SET latin1 */;
|
||||
CREATE DATABASE IF NOT EXISTS `travopti` /*!40100 DEFAULT CHARACTER SET utf8 */;
|
||||
USE `travopti`;
|
||||
|
||||
-- Exportiere Struktur von Tabelle travopti.countries
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
METEOSTAT_API_KEY=LMlDskju
|
||||
DB_HOST=localhost
|
||||
DB_USER=root
|
||||
DB_PASSWORD=devtest
|
||||
DB_PORT=3306
|
||||
5
backend/.env.sample
Normal file
5
backend/.env.sample
Normal file
@ -0,0 +1,5 @@
|
||||
METEOSTAT_API_KEY=
|
||||
DB_HOST=
|
||||
DB_USER=
|
||||
DB_PASSWORD=
|
||||
DB_PORT=
|
||||
@ -11,7 +11,7 @@ const app = express()
|
||||
const port = 3000
|
||||
//const multiplier_temp = 5
|
||||
const multiplier = {
|
||||
temperature_mean: 5,
|
||||
temperature_mean_max: 5,
|
||||
percipitation: 3.5,
|
||||
raindays: 3,
|
||||
sunhours: 2.5,
|
||||
@ -64,7 +64,7 @@ function searchHandler(req, res) {
|
||||
console.log('Q:', q)
|
||||
|
||||
let queryObj = {}
|
||||
if (q.temperature) queryObj['temperature_mean'] = q.temperature
|
||||
if (q.temperature) queryObj['temperature_mean_max'] = q.temperature
|
||||
if (q.percipitation) queryObj['percipitation'] = q.percipitation
|
||||
if (q.raindays) queryObj['raindays'] = q.raindays
|
||||
if (q.sunhours) queryObj['sunhours'] = q.sunhours
|
||||
@ -88,11 +88,11 @@ async function scoreAndSearch(from, to, queries) {
|
||||
|
||||
// randomize if empty queries
|
||||
if (_.isEmpty(queries)) {
|
||||
let t = _.round(_.random(minMax.min.temperature_mean, minMax.max.temperature_mean-5),0)
|
||||
let t = _.round(_.random(minMax.min.temperature_mean_max, minMax.max.temperature_mean_max-5),0)
|
||||
let p = _.round(_.random(minMax.min.percipitation, minMax.max.percipitation - 50), 0)
|
||||
let r = _.round(_.random(minMax.min.raindays, minMax.max.raindays - 5), 0)
|
||||
let s = _.round(_.random(minMax.min.sunhours, minMax.max.sunhours - 50), 0)
|
||||
queries.temperature_mean = `${t},${t + 5}`
|
||||
queries.temperature_mean_max = `${t},${t + 5}`
|
||||
queries.percipitation = `${p},${p + 50}`
|
||||
queries.raindays = `${r},${r + 5}`
|
||||
queries.sunhours = `${s},${s + 50}`
|
||||
@ -263,7 +263,7 @@ function getAllRegionsWithClimatePerMonth(month) {
|
||||
function oldToNewQuerySyntax(queries) {
|
||||
let res = {}
|
||||
try {
|
||||
if (queries.temperature_mean) res.temperature_mean = [queries.temperature_mean.split(',')[0], queries.temperature_mean.split(',')[1]]
|
||||
if (queries.temperature_mean_max) res.temperature_mean_max = [queries.temperature_mean_max.split(',')[0], queries.temperature_mean_max.split(',')[1]]
|
||||
if (queries.percipitation) res.percipitation = [queries.percipitation.split(',')[0], queries.percipitation.split(',')[1]]
|
||||
if (queries.raindays) res.raindays = [queries.raindays.split(',')[0], queries.raindays.split(',')[1]]
|
||||
if (queries.sunhours) res.sunhours = [queries.sunhours.split(',')[0], queries.sunhours.split(',')[1]]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user