Strip suffix correctly for stats.
authorCMDR furrycat <elite@furrycat.net>
Wed, 27 Jan 2016 10:58:11 +0000 (05:58 -0500)
committerCMDR furrycat <elite@furrycat.net>
Wed, 27 Jan 2016 11:05:22 +0000 (06:05 -0500)
entry.js

index 95d642c..ae51f57 100644 (file)
--- a/entry.js
+++ b/entry.js
@@ -220,14 +220,16 @@ function speed(distance, time) {
 
 /* Format a distance. */
 function format_distance(distance, suffix) {
-  if (suffix !== false) suffix = 'Ly';
+  if (typeof suffix != 'undefined') suffix = '';
+  else suffix = 'Ly';
   return String(distance.toFixed(2)) + suffix;
 }
 
 /* Format a speed. */
 function format_speed(speed, suffix) {
-  if (suffix !== false) suffix = '/h';
-  return format_distance(speed) + suffix;
+  if (typeof suffix != 'undefined') suffix = '';
+  else suffix = '/h';
+  return format_distance(speed, suffix);
 }
 
 /* Find the joker checkbox. */