lml/ost — pull request #252 by kevinburleigh75 (2013-03-11 08:40:24+00:00)
Title: Fixes AssignmentPlan start/end times at creation

This should close issue #248.

AssignmentPlans hold their starts_at/ends_at times, but the timezone is stored in the Klass, which is accessed via the LearningPlan (`ap.learning_plan.klass.time_zone`). This indirection, the order of initialization, and the fact that all times are stored in UTC combined to cause timezone calculation errors. These errors are especially evident when the range in question spans a DST change...

Because the LearningPlan is already set when updating an AssignmentPlan, the erroneous times were correctable by editing (as mentioned by @matthewmoravec).

This change ensures that the AssignmentPlan's LearningPlan is set _before_ the starts_at/ends_at times during create, and should result in the correct time being stored and displayed.