{"comment":{"url":"https://api.github.com/repos/concord-consortium/codap/comments/11774874","html_url":"https://github.com/concord-consortium/codap/commit/7ff9948815c8a4ae256b09cfce38ebedf9474594#commitcomment-11774874","id":11774874,"user":{"login":"sfentress","id":35721,"avatar_url":"https://avatars.githubusercontent.com/u/35721?v=3","gravatar_id":"","url":"https://api.github.com/users/sfentress","html_url":"https://github.com/sfentress","followers_url":"https://api.github.com/users/sfentress/followers","following_url":"https://api.github.com/users/sfentress/following{/other_user}","gists_url":"https://api.github.com/users/sfentress/gists{/gist_id}","starred_url":"https://api.github.com/users/sfentress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfentress/subscriptions","organizations_url":"https://api.github.com/users/sfentress/orgs","repos_url":"https://api.github.com/users/sfentress/repos","events_url":"https://api.github.com/users/sfentress/events{/privacy}","received_events_url":"https://api.github.com/users/sfentress/received_events","type":"User","site_admin":false},"position":93,"line":127,"path":"apps/dg/models/collection_model.js","commit_id":"7ff9948815c8a4ae256b09cfce38ebedf9474594","created_at":"2015-06-19T20:12:03Z","updated_at":"2015-06-19T20:12:03Z","body":"I think this change broke the caseIDToIndexMap, although I don't know enough about the model to see any visible effect of it.\r\n\r\nCurrently, if you inspect the caseIDToIndexMap of any collection, every index is \"NaN.\"\r\n\r\nIt looks like this is because the first case that is created has no parent, so parentID is undefined, so caseCounts[parentID] is undefined.\r\n\r\nPreviously, the equality operator was used, and since null == undefined, caseCounts[parentID] was assigned 0, and caseCounts[parentID]++ was 1.\r\n\r\nNow with the identity operator, caseCounts[parentID] remains undefined and caseCounts[parentID]++ is NaN, which is propagated for all future caseCounts.\r\n\r\nHowever, as I said, I don't currently see any effect of this. \r\n\r\nI am currently implementing the ability to insert a case into an arbitrary index of a collection, so I had assumed that it would be important to keep this map correct. But if this map being all \"NaN\" hasn't caused any ill-effects, then maybe the whole map isn't needed?\r\n\r\nIf the map is needed after all, this could be fixed by using `SC.none` instead of `=== null`"}}