From 42c5bf0d316653567321d78975a8e4c096856647 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Mon, 02 Nov 2020 22:36:07 +0000
Subject: [PATCH] [map] Fix differential data support

---
 map.js |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/map.js b/map.js
index 3b726c2..1cc411e 100644
--- a/map.js
+++ b/map.js
@@ -268,12 +268,6 @@
 			}),
 			text: new ol.style.Text({
 				font: 'bold 10px sans-serif',
-				// TODO: special directions
-				// vehicle.line = vehicle.name.substr(0, vehicle_name_space);
-				// vehicle.direction = normalizeName(vehicle.name.substr(vehicle_name_space+1));
-				// if(special_directions[vehicle.direction]) {
-				// 	vehicle.line = special_directions[vehicle.direction];
-				// }
 				text: feature.get('line'),
 				fill: new ol.style.Fill({color: 'white'}),
 			}),
@@ -386,12 +380,15 @@
 			api_url + '/positions/?type=' + this.prefix + '&last=' + this.lastUpdate
 		).done(function(data) {
 			try {
+				if(data['date'] < self.lastUpdate) {
+					console.log('Data older than lastUpdate!');
+				}
 				if(data['type'] == 'full') {
 					self.loadFullData(data['pos']);
 				} else {
 					self.loadDiffData(data['pos']);
 				}
-				self.lastUpdate = data['last'];
+				self.lastUpdate = data['date'];
 				setTimeout(self.fetchXhr.bind(self), api_refresh);
 			} catch(e) {
 				console.log(e);

--
Gitblit v1.9.1