peter-mount / nre-feeds

go library & Application for handling the NRE DarwinD3 feeds
Apache License 2.0
8 stars 0 forks source link

On the d3/schedule rest service, the reported delay is wrong #5

Open peter-mount opened 6 years ago

peter-mount commented 6 years ago

Today there's a lot of disruption in the south east due to heavy rain & gales & I spotted this service which is delayed by about 45-50 minutes: 201804308706701

On the service display page on departure boards it's showing as left on time. Looking at the JSON the delay value is definitely wrong { "type": "IP", "tiploc": "MSTONEE", "displaytime": "07:40:00", "timetable": { "time": "07:40:00", "pta": "07:39", "ptd": "07:40", "wta": "07:38:30", "wtd": "07:40:00" }, "delay": 0, "planned": { "activity": "T " }, "forecast": { "time": "08:28:00", "arrived": true, "departed": true, "arr": { "at": "08:27:00", "src": "TD" }, "dep": { "at": "08:28:00", "src": "TD" }, "plat": { "plat": "2", "confirmed": true, "source": "A" } } }, Here it's saying it's ontime (Delay=0) but the equation to calculate that field is forecast.time - timetable.time which should read as 48 minutes (Delay=2880).

Earlier at Swanley: { "type": "IP", "tiploc": "SWLY", "displaytime": "07:04:00", "timetable": { "time": "07:04:30", "pta": "07:04", "ptd": "07:04", "wta": "07:03:30", "wtd": "07:04:30" }, "delay": -30, "planned": { "activity": "T " }, "forecast": { "time": "07:50:00", "arrived": true, "departed": true, "arr": { "at": "07:50:00", "src": "TD" }, "dep": { "at": "07:50:00", "src": "TD" }, "plat": { "plat": "2", "confirmed": true, "source": "A" } } }, Here it's showing Delay=-30 (i.e. early) when it should read 45m30s (Delay=2730).

The code that sets this seems to be correct:

darwind3/location.go line 323: l.Delay = l.Forecast.Time.Get() - l.Times.Time.Get()

Here's the json for that service: 201804308706701.json.txt