Commit 06a3a1f1fb2ab8eabfac941126ce07d368b8dd3b
1 parent
9a630b01
Exists in
master
and in
2 other branches
Continue bug hunting.
Showing
2 changed files
with
9 additions
and
5 deletions
Show diff stats
web/static/js/swapp.ls
@@ -128,18 +128,21 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE | @@ -128,18 +128,21 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE | ||
128 | url = sw.buildDataUrlForTarget(target_slug, started_at, stopped_at) | 128 | url = sw.buildDataUrlForTarget(target_slug, started_at, stopped_at) |
129 | d3.csv(url, (csv) -> | 129 | d3.csv(url, (csv) -> |
130 | timeFormat = d3.timeParse('%Y-%m-%dT%H:%M:%S%Z') | 130 | timeFormat = d3.timeParse('%Y-%m-%dT%H:%M:%S%Z') |
131 | - data = {'hci': []}; | 131 | + data = { 'hci': [] } |
132 | configuration['parameters'].forEach((parameter) -> | 132 | configuration['parameters'].forEach((parameter) -> |
133 | - data[parameter['id']] = [] | 133 | + data[parameter['id']] = [] |
134 | ) | 134 | ) |
135 | + unless csv then reject "CSV is empty or nonexistent at URL '#{url}'." | ||
135 | csv.forEach((d) -> | 136 | csv.forEach((d) -> |
136 | dtime = timeFormat(d['time']) | 137 | dtime = timeFormat(d['time']) |
137 | configuration['parameters'].forEach((parameter) -> | 138 | configuration['parameters'].forEach((parameter) -> |
138 | id = parameter['id'] | 139 | id = parameter['id'] |
139 | data[id].push({x: dtime, y: parseFloat(d[id])}) | 140 | data[id].push({x: dtime, y: parseFloat(d[id])}) |
140 | ) | 141 | ) |
141 | - if (d['xhci'] && d['yhci']) | ||
142 | - data['hci'].push({t: dtime, x: parseFloat(d['xhci']), y: parseFloat(d['yhci'])}); | 142 | + if d['xhci'] and d['yhci'] |
143 | + data['hci'].push({ | ||
144 | + t: dtime, x: parseFloat(d['xhci']), y: parseFloat(d['yhci']) | ||
145 | + }) | ||
143 | ) | 146 | ) |
144 | resolve(data) | 147 | resolve(data) |
145 | ) | 148 | ) |
web/view/home.html.jinja2
@@ -395,9 +395,10 @@ var configuration = { | @@ -395,9 +395,10 @@ var configuration = { | ||
395 | ] | 395 | ] |
396 | }; | 396 | }; |
397 | 397 | ||
398 | +var sw; | ||
398 | jQuery().ready(function($){ | 399 | jQuery().ready(function($){ |
399 | // Space Weather app itself, handling data downloads and plot draws. | 400 | // Space Weather app itself, handling data downloads and plot draws. |
400 | - var sw = new SpaceWeather(configuration); | 401 | + sw = new SpaceWeather(configuration); |
401 | sw.init(); | 402 | sw.init(); |
402 | 403 | ||
403 | // User Interface (except plots' interactivity, such as mouse hovers) | 404 | // User Interface (except plots' interactivity, such as mouse hovers) |