# HG changeset patch # User Nathan Phillip Brink # Date 2012-02-07 20:35:21 # Node ID 2d41f5d80104bb8b71b18c45d039b5fc22750eec # Parent ed47aeab03f2be537be03fef4088deb43ca6916b Add support for detecting the start and end times of a semester, which enables the correct semester to be automatically selected. diff --git a/school.d/umich.crawl.inc b/school.d/umich.crawl.inc --- a/school.d/umich.crawl.inc +++ b/school.d/umich.crawl.inc @@ -283,6 +283,24 @@ function umich_crawl_semester(array $sch $row_accumulation['Instructor']), $meeting_type, $credit_hours); + + /* + * If the section so far passed as being a normal section, use + * its start and end dates to help determine the semester's + * respective start and end dates. + */ + $date_start_tm = strptime(trim($row[$fields['Start Date']]), '%m/%d/%Y'); + $date_end_tm = strptime(trim($row[$fields['End Date']]), '%m/%d/%Y'); + if (!empty($date_start_tm) && !empty($date_end_tm)) + { + $date_start = school_crawl_gmmktime($date_start_tm); + $date_end = school_crawl_gmmktime($date_end_tm); + if ($date_start > 1000000 && $date_end > 1000000) + { + $semester->time_start_set_test($date_start); + $semester->time_end_set_test($date_end); + } + } } }