learningequality/ka-lite — pull request #217 by bcipolli (2013-07-09 15:11:24+00:00)
Title: Improving update page robustness

This is dependent on #201, and was developed while working on #215.

These are some enhancements to the logic, execution, and display of the video update code, enabled by #201. They were useful changes made during debugging, while making #201 and #215 more robust. Specifically,
* Ordering of videos being downloaded vs. being displayed was implicit and fragile (depending on ordering of dictionaries). I moved to use OrderedDict (which is now OK), and explicitly set order parameters on VideoFile database queries.
* I tweaked display logic for the update page for the "total update" to range between 0 and 100, and to avoid dependencies on particular ordering or assumptions about the ordering from the api. This should make the code more robust.
* I weaked logic in 3 places that wound up allowing multiple processes to download videos simultaneously, without collision, and have that properly update from the update page. I don't think this is an important use-case, but in making the two above changes, a single-line change in videodownload.py was all that was needed.