NREL / floorspace.js

Other
66 stars 35 forks source link

Internal IDs appended instead of summed, causing severe bug #378

Closed Mkellyeng closed 3 years ago

Mkellyeng commented 3 years ago

Context: If the internal ID exceeds 16 digits, floorspace enters a severely bugged state where you can't modify the file any further. 16 digits is a lot though, so it should never be a problem

Problem: When you save, close, and reopen a floorspace JSON, the internal ID counter appends "1" to the highest ID, and continues counting from that new number, adding a digit. In practice this means you can only save, close, reopen a finite number of times.

I've attached 3 floorspace JSON files, in which I've replicated the issue on the web version of floorspace (https://nrel.github.io/floorspace.js/). Floorspace ID Test 01.json - Created the file, added one space, and saved. Floorspace ID Test 02.json - Closed and reopened previous, added a second space, and saved. Floorspace ID Test 03.json - Closed and reopened previous, added a second story, and saved.

Floorspace ID Test 01.json - Highest ID is "13" Floorspace ID Test 02.json - IDs continue counting from is "131", highest ID is "138" Floorspace ID Test 03.json - IDs continue counting from is "1381", highest ID is "1384"

Floorspace ID Test.zip

The bugged state: I don't have an example on hand, but this issue (https://github.com/NREL/floorspace.js/issues/377) appears to be in this state, based on what I've seen in the past. You basically can't create anything that uses an ID, so adding a new story or space has the strange double highlighting effect, and you can't draw any new spaces.

Mkellyeng commented 3 years ago

I've tried saving without closing and reopening each time. This did not cause the IDs to append. So it looks like it happens on the 'open' Floorspace ID Test b.zip

bgschiller commented 3 years ago

Fixed with #379