From 0e0ad64830306891ff29a1ba0732cc562e5afb38 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 4 Aug 2016 10:41:58 -0700 Subject: [PATCH] Fixed issue with wrong deltas being applied --- example/localTimeSystem/src/LocalTimeSystem.js | 4 ++-- main.js | 1 + .../conductor/src/ui/TimeConductorController.js | 15 ++++++++++----- .../utcTimeSystem/src/UTCTimeSystem.js | 1 - 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/example/localTimeSystem/src/LocalTimeSystem.js b/example/localTimeSystem/src/LocalTimeSystem.js index 608fc8cbc80..b109360828e 100644 --- a/example/localTimeSystem/src/LocalTimeSystem.js +++ b/example/localTimeSystem/src/LocalTimeSystem.js @@ -27,6 +27,7 @@ define([ ], function (TimeSystem, LocalClock, LADTickSource) { var FIFTEEN_MINUTES = 15 * 60 * 1000, THIRTY_MINUTES = 30 * 60 * 1000, + ONE_HOUR = 60 * 60 * 1000, DEFAULT_PERIOD = 1000; /** @@ -73,8 +74,7 @@ define([ key: 'local-default', name: 'Local 12 hour time system defaults', mode: 'fixed', - deltas: {start: FIFTEEN_MINUTES, end: 0}, - bounds: {start: now - FIFTEEN_MINUTES, end: now} + bounds: {start: now - ONE_HOUR, end: now} }, { key: 'local-default', diff --git a/main.js b/main.js index e5cef68b883..078c50f5385 100644 --- a/main.js +++ b/main.js @@ -106,6 +106,7 @@ define([ './platform/search/bundle', './platform/status/bundle', './platform/commonUI/regions/bundle' + //'./example/localTimeSystem/bundle' ], function (Main, legacyRegistry) { return { diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js index 4a5bbbc6e66..23d8d648017 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js @@ -261,6 +261,8 @@ define( break; } newMode.initialize(); + this.setDeltasFromDefaults(newMode.defaults()); + this.conductorService.mode(newMode); //Synchronize scope with time system on mode @@ -275,8 +277,7 @@ define( /** * @private */ - TimeConductorController.prototype.setDeltasFromMode = function (mode) { - var defaults = mode.defaults(); + TimeConductorController.prototype.setDeltasFromDefaults = function (defaults) { var deltas = defaults.deltas; /* @@ -312,12 +313,16 @@ define( */ TimeConductorController.prototype.setTimeSystem = function (newTimeSystem) { if (newTimeSystem && newTimeSystem !== this.$scope.timeSystemModel.selected) { + + var mode = this.conductorService.mode(); + mode.timeSystem(newTimeSystem); + var defaults = mode.defaults(); + this.$scope.timeSystemModel.selected = newTimeSystem; this.$scope.timeSystemModel.format = newTimeSystem.formats()[0]; this.$scope.timeSystemModel.deltaFormat = newTimeSystem.deltaFormat(); - var mode = this.conductorService.mode(); - mode.timeSystem(newTimeSystem); - this.setDeltasFromMode(mode); + + this.setDeltasFromDefaults(defaults); // If current mode supports ticking, set an appropriate tick // source from the new time system diff --git a/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js b/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js index 9338180ce1e..29aeb83f2a1 100644 --- a/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js +++ b/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js @@ -78,7 +78,6 @@ define([ key: 'utc-default', name: 'UTC time system defaults', mode: 'fixed', - deltas: {start: FIFTEEN_MINUTES, end: 0}, bounds: {start: now - FIFTEEN_MINUTES, end: now} } ];