TireSwingSoftware/openassign-server — pull request #31 by jimallman (2011-10-27 20:00:31+00:00)
Title: Improvements to resource-tracking methods

Michael,

I've implemented most of your suggestions in my recent code. I believe it strikes the right balance now between performance and security, and still allows calling some of the support methods directly from the client app. Two possible points of interest:

- I moved `get_sessions_using_resource()` into a custom model manager on the `Session` model class. This seems to be the recommended practice for query-ish things, versus a static or class method on the model.

- Note that range queries in Django ORM are inclusive, so the scheduling logic will currently register a conflict if we compare a test span (say, 4:30 - 5pm) with a session that runs from 5pm - 6pm. If we want to allow "zero travel time" for resources between sessions, I'll apparently need to change these queries from span to use less-than and greater-than.