Changeset - 34aabb706e18
[Not reviewed]
default
0 2 0
Nathan Brink (binki) - 15 years ago 2011-03-22 00:32:41
ohnobinki@ohnopublishing.net
Fix some php errors by removing empty courses completely.

This case was not caught before because courses may appear to be nonempty during the parsing of POST data. Thus, an additional filtering process was added.
2 files changed with 14 insertions and 1 deletions:
0 comments (0 inline, 0 general)
inc/class.schedule.php
Show inline comments
 
@@ -154,6 +154,19 @@ class Schedule
 
  //--------------------------------------------------
 
	function findPossibilities()
 
	{
 
	  /*
 
	   * Clean crud (completely empty courses) out of the
 
	   * schedule. For some crud, it's much easier to detect that
 
	   * it's crud now than during parsing of postData[].
 
	   */
 
	  foreach ($this->courses as $i => $course)
 
	    if (!$course->getnsections())
 
	      {
 
		unset($this->courses[$i]);
 
		$this->courses = array_values($this->courses);
 
		return $this->findPossibilities();
 
	      }
 

	
 
		$this->possiblePermutations = 1;
 
		/* special case: there is nothing entered into the schedule and thus there is one, NULL permutation */
 
		if (!count($this->courses))
process.php
Show inline comments
 
@@ -178,7 +178,7 @@ if(!$DEBUG)
 
				  /* Skip the section name, which isn't a section */
 
					if(is_array($section))
 
					  {
 
					    $error_string = $allClasses->addSection($class['name'], $section['letter'], $section['start'], $section['end'], arrayToDays($section['days'], 'alpha'), $section['synonym'], $section['professor'], $section['location'], $section['type']);
 
					    $error_string = $allClasses->addSection($class['name'], $section['letter'], $section['start'], $section['end'], arrayToDays(empty($section['days']) ? array() : $section['days'], 'alpha'), $section['synonym'], $section['professor'], $section['location'], $section['type']);
 
					    if ($error_string !== NULL)
 
					      $errors[] = $error_string;
 
					  }
0 comments (0 inline, 0 general)