codecombat/codecombat — pull request #874 by dpen2000 (2014-04-20 00:11:44+00:00)
Title: Fix deltas referring to last system saved

If a system is added, it is added to treema at the end of the list of systems. Treema then raises it's changed event resulting in this order being set on the level. The next time a system is added, the first system is in it's correct position and so the delta shows it as moving. This changes ensures we save the correct order in the first instance.

There is a wider issue of adding systems resulting in misleading deltas. I've submitted one-time fix to Michael to reorder systems correctly on levels in the mongo database to avoid adding a system resulting in multiple deltas relating to pre-existing systems. The fix in this PR seems to fix the majority of this issue after the one-time fix is applied. I've got a further fix to how we configure the json differ that seems to be required in a couple of instances but I want to look at this again more thoroughly to understand what's going on.