mirror of
https://gitlab.silvrtree.co.uk/martind2000/old-silvrgit.git
synced 2025-01-25 16:36:17 +00:00
removed duplication from train disruption
This commit is contained in:
parent
658bbea5a4
commit
103ef6046b
13
lib/today.js
13
lib/today.js
@ -8,6 +8,7 @@ var log4js = require('log4js');
|
||||
var logger = log4js.getLogger();
|
||||
var calHandler = require('./calHandler');
|
||||
|
||||
|
||||
var todayCache = {
|
||||
last: 0,
|
||||
data: {
|
||||
@ -221,9 +222,15 @@ module.exports = {
|
||||
// join arrays
|
||||
|
||||
for (var i = 0; i < outputArray.length; i++) {
|
||||
var p = todayCache.data.trains.data.indexOf(outputArray[i].title);
|
||||
console.log('P: ' + p);
|
||||
todayCache.data.trains.data.push(outputArray[i])
|
||||
var flag=false;
|
||||
for (var j = 0; j < todayCache.data.trains.data.length;j++)
|
||||
{
|
||||
flag = _.isEqual(todayCache.data.trains.data[j], outputArray[i])
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
todayCache.data.trains.data.push(outputArray[i]);
|
||||
}
|
||||
}
|
||||
todayCache.data.trains.data = _.uniq(todayCache.data.trains.data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user