Changeset - 303e331cb53f
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 13 years ago 2012-08-30 12:18:21
ohnobinki@ohnopublishing.net
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.
1 file changed with 18 insertions and 0 deletions:
0 comments (0 inline, 0 general)
inc/class.semester.inc
Show inline comments
 
modified file chmod 100755 => 100644
 
@@ -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;
 
  }
0 comments (0 inline, 0 general)