somerandomsequence/food-rescue-robot — pull request #8 by zedoyle (2014-05-31 01:02:28+00:00)
Title: Schedule Chains: food rescue routes with >=2 stops

* Role of Schedule model replaced with ScheduleChain, which retains all of Schedule's old all-route attributes (difficulty, notes, hilliness, avg. weight, etc.) and has a one-to-many relationship with the "new" Schedules, which each represent a single stop, donor or recipient, encapsulating both the Location reference and possible FoodTypes accepted from a donor. Even conventional two-stop schedules are converted to schedule chains in the migrate.
* In order to accommodate for more complex routes without greatly increasing the number of forms volunteers need to fill out, Logs can now correspond to multiple donors (but only one recipient). An intermediary table, LogDonors, was added to facilitate the many-to-many relation needed here.
* Log generation revised to create appropriate logs from schedule chains: the log generator iterates through each chain's stops, creating a log for each donors->recipient combination. E.g., generating logs from the schedule chain [D1->D2->Ra->D3->Rb] would result in two logs: {[D1,D2]->Ra} and {[D1,D2,D3]->Rb}.
* Views and controllers updated accordingly - generally, wherever a table element had two columns for donor and recipient, it was instead given a single column listing each stop and its donor/recipient status. Each schedule chain's individual page now displays an embedded Google Maps route with appropriate waypoints. Logs list all of their donors, followed by a "->", then their recipient.
* Email reminders updated to respect empty logs and scheduled pickups with multiple donors.
* All changes to the database schema in one migrate file, create_schedule_chains, which converts existing logs and schedules into their post-migration form.