learningequality/ka-lite — pull request #818 by bcipolli (2013-10-13 13:05:23+00:00)
Title: Minimize queries 2

Cleanup:
* Move `status` function from `securesync` app to `main` app--`securesync` should be agnostic to any KA-specific data (or any other learning material), and so cannot report on points. `main` is already a mix between app-general (running the distributed server) and KA-specific data (running the KA Lite app), so it best live there.
* This is done to enable a potential code change on when total points are computed.

Query reduction:
1. Eliminate extra queries for `FacilityUser` in student's own coach report, but keep query for when coach is viewing student coach report.
2. Eliminate unnecessary queries from `get_user_from_request`--only run queries when user id is specified in the querystring.

Testing:
* Ran with `LOGGING` set to view SQL queries.
* Ran automated tests

PR help requests:
* Timing: this is very low impact, aiming to commit this by Monday evening (~48 hours)
* @gimick could you benchmark to see if this improves performance? I also have another PR coming to compare to.
* @jamalex could you take a look at the reorg code? I'm pretty confident it's the right thing, given the view above, but glad to hear your thoughts before committing.