From 06a3a1f1fb2ab8eabfac941126ce07d368b8dd3b Mon Sep 17 00:00:00 2001 From: Goutte Date: Wed, 19 Jul 2017 14:30:11 +0200 Subject: [PATCH] Continue bug hunting. --- web/static/js/swapp.ls | 11 +++++++---- web/view/home.html.jinja2 | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/web/static/js/swapp.ls b/web/static/js/swapp.ls index a983d2e..a5aaab5 100644 --- a/web/static/js/swapp.ls +++ b/web/static/js/swapp.ls @@ -128,18 +128,21 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE url = sw.buildDataUrlForTarget(target_slug, started_at, stopped_at) d3.csv(url, (csv) -> timeFormat = d3.timeParse('%Y-%m-%dT%H:%M:%S%Z') - data = {'hci': []}; + data = { 'hci': [] } configuration['parameters'].forEach((parameter) -> - data[parameter['id']] = [] + data[parameter['id']] = [] ) + unless csv then reject "CSV is empty or nonexistent at URL '#{url}'." csv.forEach((d) -> dtime = timeFormat(d['time']) configuration['parameters'].forEach((parameter) -> id = parameter['id'] data[id].push({x: dtime, y: parseFloat(d[id])}) ) - if (d['xhci'] && d['yhci']) - data['hci'].push({t: dtime, x: parseFloat(d['xhci']), y: parseFloat(d['yhci'])}); + if d['xhci'] and d['yhci'] + data['hci'].push({ + t: dtime, x: parseFloat(d['xhci']), y: parseFloat(d['yhci']) + }) ) resolve(data) ) diff --git a/web/view/home.html.jinja2 b/web/view/home.html.jinja2 index 837f123..f722a77 100755 --- a/web/view/home.html.jinja2 +++ b/web/view/home.html.jinja2 @@ -395,9 +395,10 @@ var configuration = { ] }; +var sw; jQuery().ready(function($){ // Space Weather app itself, handling data downloads and plot draws. - var sw = new SpaceWeather(configuration); + sw = new SpaceWeather(configuration); sw.init(); // User Interface (except plots' interactivity, such as mouse hovers) -- libgit2 0.21.2