Skip to content

Commit

Permalink
Fixed a bug causing duplicate object IDs
Browse files Browse the repository at this point in the history
The ID values for new "Selection" objects were being generated by the line "String.fromCharCode(65 + Math.floor(Math.random() * 26)) + Date.now()", which led to the Auto-detection feature frequently skipping pages in large documents. The unique IDs are now simply generated by converting Math.random() to a string.
  • Loading branch information
willswope authored Feb 1, 2018
1 parent 5437dd4 commit cef4483
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion webapp/static/js/pdf_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Tabula.Selections = Backbone.Collection.extend({
createHiddenSelection: function(sel){
new_selection_args = _.extend({'page_number': sel.page,
'extraction_method': 'spreadsheet',
'id': String.fromCharCode(65 + Math.floor(Math.random() * 26)) + Date.now(),
'id': Math.random().toString(),
'hidden': true,
'pdf_document': this.pdf_document},
sel);
Expand Down

0 comments on commit cef4483

Please # to comment.