Skip to content

Commit 7a8878f

Browse files
author
Peter
committed
fixing small display bug of times
1 parent dbf2b95 commit 7a8878f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

web/src/main/webapp/js/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ function addInstruction(main, indi, title, distance, time, latLng) {
795795
window.location.pathname + "img/" + indi + ".png'/>";
796796
var str = "<td class='instr_title'>" + title + "</td>";
797797

798-
if (distance && distance.indexOf("0 ") < 0)
798+
if (distance && distance.indexOf("0 ") != 0)
799799
str += " <td class='instr_distance_td'><span class='instr_distance'>" + distance + "<br/>" + time + "</span></td>";
800800

801801
if (indi !== "continue")
@@ -905,7 +905,7 @@ function floor(val, precision) {
905905
}
906906

907907
function round(val, precision) {
908-
if (!precision)
908+
if (precision === undefined)
909909
precision = 1e6;
910910
return Math.round(val * precision) / precision;
911911
}

web/src/test/webapp/spec/UtilsSpec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ describe("utils", function() {
1313

1414
expect(createTimeString(260493166)).toBe("3d");
1515
expect(createTimeString(3642407)).toBe("1h");
16+
expect(createTimeString(12000)).toBe("0min");
1617
});
1718

1819
it("should format translation string correctly", function() {

0 commit comments

Comments
 (0)