From 7994cf1a82cc7498f2248ba4b6b4f3baa9a32a7a Mon Sep 17 00:00:00 2001 From: Goutte Date: Fri, 14 Jul 2017 04:34:49 +0200 Subject: [PATCH] Hunt bugs. --- web/static/js/swapp.js | 23 +++++++++++------------ web/static/js/swapp.ls | 24 +++++++++++------------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/web/static/js/swapp.js b/web/static/js/swapp.js index 0adf8ae..1ba8270 100644 --- a/web/static/js/swapp.js +++ b/web/static/js/swapp.js @@ -36,18 +36,15 @@ this.configuration['parameters'].forEach(function(p){ return this$.parameters[p['id']] = p; }); + this.orbiter = null; this.timeSeries = []; } SpaceWeather.prototype.init = function(){ "This is called by the inline bootstrap javascript code.\nThis ain't in the constructor because it might return a Promise later on.\n(for the loader, for example)"; var started_at, stopped_at, this$ = this; - this.orbits = new Orbits(this.configuration.orbits_container, this.configuration); - this.started_at = moment().subtract(1, 'years').hours(0).minutes(0).seconds(0); - this.stopped_at = moment().add(7, 'days').hours(0).minutes(0).seconds(0); - started_at = this.started_at.format(API_TIME_FORMAT); - stopped_at = this.stopped_at.format(API_TIME_FORMAT); - console.info("Setting time interval from " + started_at + " to " + stopped_at + "…"); - this.setStartAndStop(this.started_at, this.stopped_at); + started_at = moment().subtract(1, 'years').hours(0).minutes(0).seconds(0); + stopped_at = moment().add(7, 'days').hours(0).minutes(0).seconds(0); + this.setStartAndStop(started_at, stopped_at); this.loadAndCreatePlots(started_at, stopped_at); return window.addEventListener('resize', function(){ return this$.resize(); @@ -142,6 +139,9 @@ "started_at: moment(.js) object\nstopped_at: moment(.js) object"; var active_targets, res$, k, this$ = this; this.showLoader(); + this.started_at = started_at; + this.stopped_at = stopped_at; + this.orbits = new Orbits(this.configuration.orbits_container, this.configuration); started_at = started_at.format(API_TIME_FORMAT); stopped_at = stopped_at.format(API_TIME_FORMAT); res$ = []; @@ -258,11 +258,9 @@ return [this.started_at, this.stopped_at]; }; SpaceWeather.prototype.resizeDomain = function(started_at, stopped_at){ - var tmp, formatted_started_at, formatted_stopped_at; + var ref$, formatted_started_at, formatted_stopped_at; if (stopped_at < started_at) { - tmp = started_at; - started_at = stopped_at; - stopped_at = started_at; + ref$ = [stopped_at, started_at], started_at = ref$[0], stopped_at = ref$[1]; } if (started_at === stopped_at) { console.warn("Please provide distinct start and stop dates."); @@ -301,6 +299,7 @@ return this; }; SpaceWeather.prototype.setStartAndStop = function(started_at, stopped_at){ + console.info("Setting time interval from " + started_at + " to " + stopped_at + "…"); this.current_started_at = started_at; this.current_stopped_at = stopped_at; $("#started_at").val(started_at.format(INPUT_TIME_FORMAT)); @@ -561,6 +560,7 @@ }; this.data = {}; this.orbiters = {}; + this.orbitersElements = {}; this.extremum = 1; this.xScale = d3.scaleLinear().domain([-1 * this.extremum, this.extremum]); this.yScale = d3.scaleLinear().domain([-1 * this.extremum, this.extremum]); @@ -587,7 +587,6 @@ $(this.svg.node()).hide(); return this.resize(); }; - Orbits.prototype.orbitersElements = {}; Orbits.prototype.initOrbiter = function(slug, config, data){ var orbit_ellipse, orbiter, orbit_line, orbit_section, this$ = this; console.info("Initializing orbit of " + config.name + "…"); diff --git a/web/static/js/swapp.ls b/web/static/js/swapp.ls index 80b6c42..9ff96f3 100644 --- a/web/static/js/swapp.ls +++ b/web/static/js/swapp.ls @@ -63,7 +63,8 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE @configuration['parameters'].forEach((p) ~> @parameters[p['id']] = p ) - @timeSeries = [] + @orbiter = null # our Orbiter + @timeSeries = [] # a List of TimeSeries objects init: -> """ @@ -71,15 +72,11 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE This ain't in the constructor because it might return a Promise later on. (for the loader, for example) """ - @orbits = new Orbits(@configuration.orbits_container, @configuration) # Default time interval is from one year ago to one week ahead. # We set the h/m/s to zero to benefit from a daily cache. - @started_at = moment().subtract(1, 'years').hours(0).minutes(0).seconds(0) - @stopped_at = moment().add(7, 'days').hours(0).minutes(0).seconds(0) - started_at = @started_at.format(API_TIME_FORMAT) - stopped_at = @stopped_at.format(API_TIME_FORMAT) - console.info "Setting time interval from #{started_at} to #{stopped_at}…" - @setStartAndStop(@started_at, @stopped_at) + started_at = moment().subtract(1, 'years').hours(0).minutes(0).seconds(0) + stopped_at = moment().add(7, 'days').hours(0).minutes(0).seconds(0) + @setStartAndStop(started_at, stopped_at) @loadAndCreatePlots(started_at, stopped_at) window.addEventListener 'resize', ~> @resize() @@ -154,6 +151,9 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE stopped_at: moment(.js) object """ @showLoader() + @started_at = started_at + @stopped_at = stopped_at + @orbits = new Orbits(@configuration.orbits_container, @configuration) started_at = started_at.format(API_TIME_FORMAT) stopped_at = stopped_at.format(API_TIME_FORMAT) active_targets = [@targets[k] for k of @targets when @targets[k].active] @@ -223,10 +223,7 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE resizeDomain: (started_at, stopped_at) -> if stopped_at < started_at - tmp = started_at - started_at = stopped_at - stopped_at = started_at - + [started_at, stopped_at] = [stopped_at, started_at] if started_at == stopped_at console.warn "Please provide distinct start and stop dates." return @@ -259,6 +256,7 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE this setStartAndStop: (started_at, stopped_at) -> + console.info "Setting time interval from #{started_at} to #{stopped_at}…" @current_started_at = started_at @current_stopped_at = stopped_at $("\#started_at").val(started_at.format(INPUT_TIME_FORMAT)) @@ -574,6 +572,7 @@ export class Orbits @data = {} # slug => HCI array @orbiters = {} # slug => config + @orbitersElements = {} @extremum = 1 @xScale = d3.scaleLinear().domain([-1 * @extremum, @extremum]) @yScale = d3.scaleLinear().domain([-1 * @extremum, @extremum]) @@ -613,7 +612,6 @@ export class Orbits $(@svg.node()).hide(); # we'll show it later when there'll be data @resize() - orbitersElements: {} initOrbiter: (slug, config, data) -> console.info "Initializing orbit of #{config.name}…" if slug of @orbitersElements then throw new Error("Second init of #{slug}") -- libgit2 0.21.2