Fix term queries and add fail-safe in course form

* Fix 1-day delay on the first day of a term
* Gracefully handle nil terms
Merge pull request #114 from va7map/fix-term_query

Fix term queries and add fail-safe in course form