Skip to content

Commit

Permalink
Fix off-by-one when selecting last timestamp from list.
Browse files Browse the repository at this point in the history
Co-authored-by: Benjamin Ross <[email protected]>
  • Loading branch information
Blake Bender and BenjaminPerryRoss committed Jun 29, 2018
1 parent 11f7a5a commit 196d639
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions fileManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ function getIndexForTimestamp(timestamp) {
if (linesIndex.timestamps[i] > timestamp) {
return (i > 0) ? i - 1 : i;
}
else if (linesIndex.timestamps[i] == timestamp) {
return i;
}
}
return -1;
}
Expand Down Expand Up @@ -98,16 +101,6 @@ function displayLines(timestamp) {
var withBreaks = buffer.toString().split("\n").join("<br />");

document.querySelector('#textGoesHere').innerHTML = withBreaks;

console.log(buffer.toString());

// while (we still need to read more lines)
// get text for entry
// count lines in text
// total lines read += lines in this entry
// index++
// elihw

}

// https://stackoverflow.com/questions/2998784/how-to-output-integers-with-leading-zeros-in-javascript
Expand All @@ -129,7 +122,6 @@ function populateTimeList()

timestampComboBox.innerHTML = options;
timestampComboBox.addEventListener('onchange', timeSelected);
console.log("onChange event handler set to " + timestampComboBox.onChange);
}

function timeSelected() {
Expand Down

0 comments on commit 196d639

Please sign in to comment.