Skip to content

Commit

Permalink
days of travel
Browse files Browse the repository at this point in the history
  • Loading branch information
Masoumeh committed Mar 19, 2018
1 parent 9955757 commit 40c0e1e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 8 additions & 1 deletion global_var.js
Expand Up @@ -67,4 +67,11 @@ var type_size =
"waystations" : 1,
"xroads" : 0.7
};
*/
*/

var graph;
//var DAY = 120000;
var DAY = 39702;
var WITHIN_A_DAY = DAY * 3;
//var MULTIPLIER = 3;
var NUM_ZONES = 5;
6 changes: 0 additions & 6 deletions graph.js
@@ -1,9 +1,3 @@
var graph;
//var DAY = 120000;
var DAY = 39702;
var WITHIN_A_DAY = DAY * 3;
//var MULTIPLIER = 3;
var NUM_ZONES = 5;

function init_graph(routes) {
var Graph = require('data-structures').Graph;
Expand Down
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -392,11 +392,11 @@ function displayDistance (container, dist, direct_dist, textValue) {
var tmpTextValue = textValue.replace(/ /g,"_").toLowerCase();
var avg_dist = (dist == 0) ? direct_dist : (dist + direct_dist) / 2;
var elem = "<p id='" + tmpTextValue + "'>" + textValue + " distance: " +
parseInt((dist/1000).toFixed()).toLocaleString('en') + " km</p>";
parseInt((dist/DAY).toFixed()).toLocaleString('en') + " days of travel</p>";
container.append(elem);
if (textValue != "Direct") {
var avg_elem = "<p style='padding-left:10px;' id='avg_" + tmpTextValue + "'>Average " + textValue.toLowerCase()
+ " distance: " + parseInt((avg_dist/1000).toFixed()).toLocaleString('en') + " km</p>";
+ " distance: " + parseInt((avg_dist/DAY).toFixed()).toLocaleString('en') + " days of travel</p>";
container.append(avg_elem);
}
}
Expand Down

0 comments on commit 40c0e1e

Please sign in to comment.