Set it so traffic only works during the week

This commit is contained in:
Martin Donnelly 2018-03-20 22:33:49 +00:00
parent 7b34834179
commit 1744d82898
2 changed files with 9 additions and 4 deletions

View File

@ -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.397' };
const CACHE_VERSION = { 'version': '0.0.399' };
const dataCacheName = 'jubileeData-v1';
const cacheName = 'jubilee-final-1';
const filesToCache = [

View File

@ -32,10 +32,16 @@ const TrafficModel = Backbone.Model.extend({
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)));
const delay = ( ((hour >= 7) && (hour <= 9)) || ((hour >= 17) && (hour <= 19)) ) ? 600000 : toHour();
let delay;
if (day === 0 || day === 6)
delay = toHour();
else
delay = ( ((hour >= 7) && (hour <= 9)) || ((hour >= 17) && (hour <= 19)) ) ? 600000 : toHour();
console.log('Delay', delay);
this.timerID = setTimeout(
() => this.tick(),
@ -59,7 +65,6 @@ const TrafficModel = Backbone.Model.extend({
// 55.872407, -3.549003
// const latlong = { 'lat':latitude, 'lon':longitude };
if ((hour >= 7) && (hour <= 9)) {
this.set('dest', 'Work');