Added carrige count to the view
This commit is contained in:
parent
9c41f5aeb8
commit
2b6f969e4a
@ -9,7 +9,7 @@ const trainCache = {
|
||||
'data': {}
|
||||
};
|
||||
|
||||
// logger.level = 'debug';
|
||||
logger.level = 'info';
|
||||
|
||||
function getTrainTimes(req, res) {
|
||||
// console.log(req);
|
||||
@ -17,6 +17,8 @@ function getTrainTimes(req, res) {
|
||||
if (req.query.hasOwnProperty('from') && req.query.hasOwnProperty('from')) {
|
||||
const url = `/all/${ req.query.from }/to/${ req.query.to }/10?accessToken=215b99fe-b237-4a01-aadc-cf315d6756d8`;
|
||||
|
||||
// logger.debug(`https://huxley.apphb.com${url}`);
|
||||
|
||||
Query(function (a, b) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
|
||||
@ -39,6 +41,8 @@ function getNextTrainTimes(req, res) {
|
||||
url = `/next/${ trainFrom }/to/${ trainTo }/1?accessToken=215b99fe-b237-4a01-aadc-cf315d6756d8`;
|
||||
logger.info(`Requesting latest time for : ${ trainToken}`);
|
||||
|
||||
// logger.debug(`https://huxley.apphb.com${url}`);
|
||||
|
||||
const now = new Date();
|
||||
const nowSeconds = (now.getHours() * (60 * 60)) + (now.getMinutes() * 60);
|
||||
logger.info(`Now Seconds: ${ nowSeconds}`);
|
||||
|
@ -193,11 +193,14 @@ const RouteView = Backbone.View.extend({
|
||||
if (typeof route.trainServices === 'object' && route.trainServices !== null)
|
||||
for (const item of route.trainServices) {
|
||||
const dest = item.destination[0];
|
||||
const via = dest.via !== null ? `<em class="mui--text-accent">${dest.via}</em>` : '';
|
||||
const via = dest.via !== null ? ` <em class="mui--text-accent">${dest.via}</em>` : '';
|
||||
const platform = item.platform !== null ? item.platform : `${symbol[0]}`;
|
||||
// 🚉 💠
|
||||
const time = item.sta !== null ? item.sta : `<em class="mui--text-accent-secondary">D</em> ${item.std}`;
|
||||
const status = item.eta !== null ? item.eta : item.etd;
|
||||
const trainLength = item.length;
|
||||
|
||||
const carriageCount = (trainLength > 0) ? ` (${trainLength} 🚃) ` : '';
|
||||
|
||||
const statusMode = (status.toLowerCase() === 'on time') ? 'ontime' : 'delayed';
|
||||
const delayReason = (item.delayReason !== null) ? `<tr><td colspan="4" class="mui--bg-danger mui--text-white" style="font-size:75%;">${item.delayReason}</td></tr>` : '';
|
||||
@ -206,7 +209,7 @@ const RouteView = Backbone.View.extend({
|
||||
|
||||
services.push({ 'location':dest.locationName, 'time':time, 'status':status, 'platform':platform, 'cancel':cancelReason, 'type':'train' });
|
||||
if (!item.isCancelled)
|
||||
ws = `${ws }<tr><td data-id="${item.serviceIdUrlSafe}" class="station">${dest.locationName} ${via}</td>
|
||||
ws = `${ws }<tr><td data-id="${item.serviceIdUrlSafe}" class="station">${dest.locationName}${carriageCount}${via}</td>
|
||||
<td class="mui--text-center time">${time}</td>
|
||||
<td class="mui--text-center ${statusMode}">${status}</td>
|
||||
<td class="mui--text-center">${platform}</td>
|
||||
|
Loading…
Reference in New Issue
Block a user