Skip to content
Snippets Groups Projects
Commit 5256bdae authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Fix weather data render bug

parent 8ca99c8b
Branches
No related tags found
No related merge requests found
...@@ -255,6 +255,7 @@ async function runModel(endpoint, inputData) ...@@ -255,6 +255,7 @@ async function runModel(endpoint, inputData)
*/ */
function getDateArray(timestart, interval, length) function getDateArray(timestart, interval, length)
{ {
let dateArray = []; let dateArray = [];
currentTime = moment(timestart); currentTime = moment(timestart);
for(let i=0;i< length; i++) for(let i=0;i< length; i++)
...@@ -406,7 +407,9 @@ async function isPointCoveredByDatasource(coordinate, datasource) ...@@ -406,7 +407,9 @@ async function isPointCoveredByDatasource(coordinate, datasource)
* @param {String} tableClass for styling the table, e.g. using Bootstrap * @param {String} tableClass for styling the table, e.g. using Bootstrap
*/ */
function renderWeatherData(weatherData, container, tableClass){ function renderWeatherData(weatherData, container, tableClass){
let dates = getDateArray(weatherData.timeStart, weatherData.interval, weatherData.locationWeatherData[0].length); console.info(weatherData);
let dates = getDateArray(weatherData.timeStart, weatherData.interval, weatherData.locationWeatherData[0].data.length);
let html = "<table" + (tableClass != undefined ? " class=\"" + tableClass + "\"" : "") + "><thead><tr><th>Time</th>"; let html = "<table" + (tableClass != undefined ? " class=\"" + tableClass + "\"" : "") + "><thead><tr><th>Time</th>";
weatherData.weatherParameters.forEach(function(weatherParameterId){ weatherData.weatherParameters.forEach(function(weatherParameterId){
html +="<th>" + getWeatherParameter(weatherParameterId).name + "</th>"; html +="<th>" + getWeatherParameter(weatherParameterId).name + "</th>";
......
...@@ -478,7 +478,7 @@ ...@@ -478,7 +478,7 @@
} }
// 2. Forecast weather data // 2. Forecast weather data
if(currentForecastWeatherDatasource != undefined) if(currentForecastWeatherDatasource != undefined && moment(inputData.optionalData.endDate).add(1,"days").isAfter(moment()))
{ {
coordinate = getLatLon(); coordinate = getLatLon();
if(coordinate == null) if(coordinate == null)
...@@ -518,7 +518,6 @@ ...@@ -518,7 +518,6 @@
} }
else else
{ {
// Is useless until method is implemented
weatherData = mergeWeatherData(weatherData, forecastData); weatherData = mergeWeatherData(weatherData, forecastData);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment