Skip to content

Commit

Permalink
merged
Browse files Browse the repository at this point in the history
  • Loading branch information
Pieter Colpaert committed Aug 2, 2015
2 parents 4ad66ed + 0b7babc commit cb20296
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/oSoc15/gtfs-rt-demo.git"
"url": "git+https://github.com/oSoc15/gtfs-rt-demo.git"
},
"keywords": [
"gtfs",
Expand All @@ -27,5 +27,7 @@
"gtfs-realtime-bindings": "0.0.4",
"protocol-buffers": "^3.1.2",
"request": "^2.60.0"
}
},
"homepage": "https://github.com/oSoc15/gtfs-rt-demo#readme",
"devDependencies": {}
}
11 changes: 6 additions & 5 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,31 @@
<a class="navbar-brand" href="#">GTFS Realtime</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<!--<ul class="nav navbar-nav navbar-right">
<li><a href="#">Dashboard</a></li>
<li><a href="#">Settings</a></li>
<li><a href="#">Profile</a></li>
<li><a href="#">Help</a></li>
</ul>
<form class="navbar-form navbar-right">
<input type="text" class="form-control" placeholder="Search...">
</form>
</form>-->
</div>
</div>
</nav>

<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<!--<ul class="nav nav-sidebar">
<li class="active"><a href="#">Service Alerts <span class="sr-only">(current)</span></a></li>
<li><a href="#">Reports</a></li>
<li><a href="#">Analytics</a></li>
<li><a href="#">Export</a></li>
</ul>
</ul>-->

</div>

<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">Dashboard</h1>
<p class="extraInfo"></p>
Expand Down Expand Up @@ -99,6 +99,7 @@ <h2>Trip Updates</h2>
<thead>
<tr>
<th>Train Number</th>
<th>Label</th>
<th>Delay (minutes)</th>


Expand Down
18 changes: 12 additions & 6 deletions public/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ console.log('Hi there');
parseTripUpdateData(result);
}});

setInterval(function() {
window.setInterval(function() {
console.log('Hi Minute');

$.ajax({url: "/service_alerts.json", success: function(result){
Expand All @@ -38,7 +38,8 @@ console.log('Hi there');


for( i = 0 ;i <= result.entity.length; i++){
console.log(result.entity[i].alert.header_text.translation[0].text);
//console.log(result.entity[i].alert.header_text.translation[0].text);


$(".servicesUpdate").append(" <tr>"+
"<td>"+
Expand All @@ -57,9 +58,6 @@ console.log('Hi there');
}
}
function parseTripUpdateData(result){



var totalAmountofTrainsHavingIssues = result.entity.length;
var totalTrains = 2986;
var percentageOfDelays = (totalAmountofTrainsHavingIssues / totalTrains ) *100 ;
Expand All @@ -75,11 +73,17 @@ console.log('Hi there');
for( i = 0 ;i <= result.entity.length; i++){



var routeId = result.entity[i].trip_update.trip.route_id;
var routeLabel = result.entity[i].trip_update.vehicle.label;
//console.log(routeLabel);
var reslt = routeId.split(":");

var totalDelay=0;
try {



for( t = 0 ;t <= result.entity[i].trip_update.stop_time_update.length; t++){
totalDelay += result.entity[i].trip_update.stop_time_update[t].arrival.delay;

Expand All @@ -98,10 +102,12 @@ console.log('Hi there');
reslt[1]+
"</td>"+
"<td>"+
routeLabel+
"</td>"+
"<td>"+
totalDelay+
"</td>"+
"</tr>");
// console.log(" i am an awesome cat " + result.entity[i].alert.header_text.translation[0].text);
}
}
});
4 changes: 0 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ setInterval(function() {

}, the_interval);





app.get('/servicesAlerts', function (req, res) {
console.log("Got Service Alerts Request");

Expand Down

0 comments on commit cb20296

Please sign in to comment.