From 34e5a42ea5e066a83ce6ed0be8cd6f134db8cd0b Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 19 Apr 2018 16:25:40 +0100 Subject: [PATCH 1/2] Disabled a weather test --- package-lock.json | 10 +++++----- package.json | 2 +- src/service-worker.js | 2 +- src/v1/js/Traffic.js | 32 ++++++++++++++------------------ src/v1/js/app.js | 2 +- 5 files changed, 22 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3a758de..a015e17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -52,7 +52,7 @@ }, "@sinonjs/formatio": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", "dev": true, "requires": { @@ -659,7 +659,7 @@ "resolved": "https://registry.npmjs.org/backbone/-/backbone-1.3.3.tgz", "integrity": "sha1-TMgOp8sWMaxHSInOQPL4vGg7KZk=", "requires": { - "underscore": "1.8.3" + "underscore": "1.9.0" } }, "balanced-match": { @@ -11498,9 +11498,9 @@ "dev": true }, "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.0.tgz", + "integrity": "sha512-4IV1DSSxC1QK48j9ONFK1MoIAKKkbE8i7u55w2R6IqBqbT7A/iG7aZBCR2Bi8piF0Uz+i/MG1aeqLwl/5vqF+A==" }, "union-value": { "version": "1.0.0", diff --git a/package.json b/package.json index b124fcf..60d71e7 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "sugar": "^2.0.4", "twitter": "^1.7.1", "uglifyify": "^4.0.5", - "underscore": "^1.8.3", + "underscore": "^1.9.0", "winston": "^2.4.1", "winston-mongodb": "^4.0.0-rc1", "yelp-fusion": "^2.0.3" diff --git a/src/service-worker.js b/src/service-worker.js index bd5599e..759e406 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -const CACHE_VERSION = { 'version': '0.0.689' }; +const CACHE_VERSION = { 'version': '0.0.691' }; const dataCacheName = 'jubileeData-v1'; const cacheName = 'jubilee-final-1'; const filesToCache = [ diff --git a/src/v1/js/Traffic.js b/src/v1/js/Traffic.js index fa43525..96e06b5 100644 --- a/src/v1/js/Traffic.js +++ b/src/v1/js/Traffic.js @@ -24,23 +24,20 @@ const TrafficModel = Backbone.Model.extend({ 'tick': function() { const hour = (new Date()).getHours(); - // ( ((hour >= 7) && (hour <= 9)) || ((hour >= 17) && (hour <= 19)) ) - // - console.log('this.has(\'latlong\')', this.has('latlong')); - if (this.has('latlong')) { + const day = new Date().getDay(); + + let doRequest = false; + if (day !== 0 && day !== 6) + doRequest = (((hour >= 7) && (hour <= 9)) || ((hour >= 17) && (hour <= 19))); + + const delay = doRequest ? 600000 : toHour(); + + if (this.has('latlong') && doRequest) { this.updateID = 1; this.getTraffic(); } - - const day = new Date().getDay(); - console.log('tick', this.attributes); - console.log('((hour >= 7) && (hour <= 9))', ((hour >= 7) && (hour <= 9))); - console.log('((hour >= 17) && (hour <= 19))', ((hour >= 17) && (hour <= 19))); - let delay; - if (day === 0 || day === 6) - delay = toHour(); else - delay = ( ((hour >= 7) && (hour <= 9)) || ((hour >= 17) && (hour <= 19)) ) ? 600000 : toHour(); + this.set('mode', 0); console.log('Delay', delay); this.timerID = setTimeout( @@ -52,7 +49,7 @@ const TrafficModel = Backbone.Model.extend({ this.getTraffic(); }, 'getTraffic': function() { - console.log('Get Raffic'); + console.log('Get Traffic'); // olat, olon, dlat, dlon const time = new Date().getTime() ; const hour = (new Date()).getHours(); @@ -180,15 +177,14 @@ const parts = new Map( ['9', 'left_turn'], ['13', 'right_turn'], ['11', 'continue'], - ['23','right_fork'], - ['17','left_exit'], + ['23', 'right_fork'], + ['17', 'left_exit'], ['19', 'left_ramp'], ['29', 'turn'], - ['',''] + ['', ''] ] - ); module.exports = { TrafficModel, TrafficView }; diff --git a/src/v1/js/app.js b/src/v1/js/app.js index 014ca0d..0dd446c 100644 --- a/src/v1/js/app.js +++ b/src/v1/js/app.js @@ -21,7 +21,7 @@ const { NearbyListModel, NearbyListView } = require('./NearbyList'); const { NearbyPlacesView } = require('./NearbyPlaces'); var app = app || {}; -const live = true; +const live = false; if (live) { window.loc = 'https://jubilee.silvrtree.co.uk'; From 113a003098e36346bb9033c367d49396dadf0511 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 19 Apr 2018 17:13:16 +0100 Subject: [PATCH 2/2] Fixed the traffic reporting, tidied the display --- src/service-worker.js | 2 +- src/v1/js/Traffic.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/service-worker.js b/src/service-worker.js index 759e406..ee7c7b8 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -const CACHE_VERSION = { 'version': '0.0.691' }; +const CACHE_VERSION = { 'version': '0.0.695' }; const dataCacheName = 'jubileeData-v1'; const cacheName = 'jubilee-final-1'; const filesToCache = [ diff --git a/src/v1/js/Traffic.js b/src/v1/js/Traffic.js index 96e06b5..871c459 100644 --- a/src/v1/js/Traffic.js +++ b/src/v1/js/Traffic.js @@ -138,8 +138,8 @@ const TrafficView = Backbone.View.extend({ }, 'template': _.template(`
-
mui--align-middle "> <%=readable%> to <%= dest.toLowerCase() %>
-
<%=traffic %>
+
fa-2x mui--align-middle <%= className %>"> <%=readable%> to <%= dest.toLowerCase() %> <%=traffic %>
+
`),