# HG changeset patch # User Nathan Phillip Brink # Date 2012-08-30 12:18:21 # Node ID 303e331cb53f257a9afffbc59f2659e665a8efcc # Parent a24f02c44c734b393f05370114e5546616fd384a Make the Semester class smarter about guessing it start and end times based on season to support crawling without getting exact times, fixing dordt semester detection for now. diff --git a/inc/class.semester.inc b/inc/class.semester.inc old mode 100755 new mode 100644 --- a/inc/class.semester.inc +++ b/inc/class.semester.inc @@ -335,6 +335,12 @@ class Semester $times = filter_outliers($this->time_ends); $this->time_end = max($times); } + elseif (!$this->time_end) + { + /* Return, but don't store, a guess. */ + $fourmonths = gmmktime(0, 0, 0, 5, 2012) - gmmktime(0, 0, 0, 1, 2012); + return $this->time_start_get() + $fourmonths; + } return $this->time_end; } @@ -396,6 +402,18 @@ class Semester $times = filter_outliers($this->time_starts); $this->time_end = min($times); } + elseif (!$this->time_start) + { + /* Return, but don't store, a guess. */ + $season_starts = array( + 'spring' => 0, + 'summer' => 5, + 'fall' => 8, + 'winter' => 12, + ); + if (!empty($season_starts[$this->season])) + return gmmktime(0, 0, 0, $season_starts[$this->season], $this->year); + } return $this->time_start; }