Changeset - 2cdcc3bbf6ac
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 15 years ago 2010-11-29 23:42:36
ohnobinki@ohnopublishing.net
Pull the section meeting type when crawling Calvin's registrar data.
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
school.d/calvin.crawl.inc
Show inline comments
 
@@ -298,59 +298,60 @@ function calvin_crawl(Semester $semester
 
	   * the list of days of week the section meets, the start
 
	   * time, the end time, and then the meeting location.
 
	   */
 
	  if (strpos($sec_meeting_info, 'Times to be Announced') !== FALSE
 
	      || strpos($sec_meeting_info, 'Days to be Announced') !== FALSE)
 
	    {
 
	      if ($verbosity > 2)
 
		error_log('Skipping class because of incomplete meeting time information: '
 
			  . implode('-', $section_id) . ' has meeting info of `'
 
			  . $sec_meeting_info . '\'');
 
	      $skipped_sections['incomplete meeting info'] ++;
 
	      continue;
 
	    }
 

	
 
	  if (!preg_match(';^([0-9]{2}/[0-9]{2}/[0-9]{4})-([0-9]{2}/[0-9]{2}/[0-9]{4}) (([^ ,]+ )+)([^0-9]+) ([^ ]+) - ([^ ]+), (.*)$;', $sec_meeting_info, $meeting_info_matches))
 
	    {
 
	      error_log('Unable to parse calvin section meeting info string into start/end/days information for '
 
			. implode('-', $section_id) . ': ``' . $sec_meeting_info . '\'\'');
 
	      $skipped_sections['invalid meeting info format'] ++;
 
	      continue;
 
	    }
 
	  $date_start = $meeting_info_matches[1];
 
	  $date_end = $meeting_info_matches[2];
 
	  /* e.g., 'Lecture', 'Practicum' */
 
	  $meeting_type = $meeting_info_matches[3];
 
	  $meeting_type = strtolower($meeting_info_matches[3]);
 

	
 
	  $days = school_crawl_days_format(explode(', ', $meeting_info_matches[5]));
 
	  $time_start = school_crawl_time_format(strptime($meeting_info_matches[6], '%I:%M%p'));
 
	  $time_end = school_crawl_time_format(strptime($meeting_info_matches[7], '%I:%M%p'));
 
	  $meeting_place = $meeting_info_matches[8];
 

	
 
	  if ($verbosity > 5)
 
	    foreach (array('date_start', 'date_end', 'meeting_type', 'days', 'time_start', 'time_end', 'meeting_place') as $var)
 
	    foreach (array('date_start', 'date_end', 'meeting_type', 'days', 'time_start', 'time_end', 'meeting_place', 'meeting_type') as $var)
 
	      echo $var . ':' . ${$var} . "\n";
 

	
 
	  $section = new Section($section_id['section'], array(new SectionMeeting($days, $time_start, $time_end, $meeting_place)), $synonym, $faculty_name);
 
	  $section = new Section($section_id['section'], array(new SectionMeeting($days, $time_start, $time_end, $meeting_place, $meeting_type)), $synonym, $faculty_name);
 
	  $semester->section_add($section_id['department'], $section_id['course'], $section);
 
	}
 

	
 
      if (!preg_match(';Page ([0-9]+) of ([0-9]+)\</td\>$;m', $html, $pages))
 
	{
 
	  error_log('Unable to determine the number of pages in this Calvin resultset');
 
	  break;
 
	}
 

	
 
      if ($verbosity > 0)
 
	{
 
	  echo 'calvin_crawl(): finished page ' . $pages[1] . ' of ' . $pages[2] . ' with ' . ($list_row - 1) . " courses.\n";
 
	}
 

	
 
      $form = array(
 
		    'ACTION*Grp:WSS.COURSE.SECTIONS' => 'NEXT',
 
		    );
 
    }
 

	
 
  $has_stat = FALSE;
 
  if ($verbosity > 1)
 
    foreach ($skipped_sections as $reason => $num)
 
      {
 
	if (!$num)
0 comments (0 inline, 0 general)