Changeset - 59de04d99da6
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 13 years ago 2012-11-28 00:23:13
ohnobinki@ohnopublishing.net
Fix support for displaying the number of credit hours in a permutation for schools with course slots, reported by bot10berg.

https://www.facebook.com/zimjimmy/posts/231316953666045?comment_id=886608&offset=0&total_comments=11
The linked schedule was displaying 24 credit hours instead of 14
credit hours because there were two course slots with two sections
each (each of these course slots having 4 credit hours) causing 8
credit hours to be doubly-counted.
1 file changed with 11 insertions and 1 deletions:
0 comments (0 inline, 0 general)
inc/class.schedule.php
Show inline comments
 
@@ -757,49 +757,59 @@ class Schedule
 
				      $rowspan[$dayLoop] = $my_r - $r;
 

	
 
				      $single_multi = 'single';
 
				      if ($rowspan[$dayLoop] > 1)
 
					$single_multi = 'multi';
 

	
 
				      $title = $course->title_get();
 
				      if (empty($title))
 
					$title = '';
 
				      else
 
					$title .= ' ';
 

	
 
				      $carret = '&#013;<br />';
 
				      echo '            <td rowspan="' . $rowspan[$dayLoop]
 
					. '" class="qTipCell ' . $single_multi . ' class' . $j
 
					. '" title="' . htmlentities(
 
                                          htmlentities($title, ENT_QUOTES) . $carret
 
                                          . 'Prof: ' . htmlentities($current_meeting->instructor_get(), ENT_QUOTES) . $carret
 
                                          . 'Room: ' . htmlentities($current_meeting->getLocation(), ENT_QUOTES) . $carret
 
                                          . 'Type: ' . htmlentities($current_meeting->type_get(), ENT_QUOTES) . $carret, ENT_QUOTES);
 

	
 
                                      $section_credit_hours = $section->credit_hours_get();
 
                                      if ($section_credit_hours >= 0)
 
                                        {
 
                                          $credit_hours[$section->getSynonym()] = $section_credit_hours;
 
                                          /*
 
                                           * We can only count credit
 
                                           * hours once per course,
 
                                           * otherwise for school that
 
                                           * use course_slots we count
 
                                           * credit hours for multiple
 
                                           * sections in the same
 
                                           * course and get ridiculous
 
                                           * numbers. https://www.facebook.com/zimjimmy/posts/231316953666045?comment_id=886608&offset=0&total_comments=11
 
                                           */
 
                                          $credit_hours[$course->getName()] = $section_credit_hours;
 
                                          $have_credit_hours = TRUE;
 

	
 
                                          echo htmlentities('Credits: ' . htmlentities($section_credit_hours, ENT_QUOTES) . $carret, ENT_QUOTES);
 
                                        }
 
                                      echo '">'
 
					. '<span class="course-title block">' . htmlentities($title) . '</span>' . PHP_EOL
 
					. htmlentities($course->getName(), ENT_QUOTES) . '-'
 
					. htmlentities($section->getLetter(), ENT_QUOTES) . "\n"
 
					. '<span class="prof block">' . htmlentities($current_meeting->instructor_get(), ENT_QUOTES) . "</span>\n"
 
					. '<span class="location block">' . htmlentities($current_meeting->getLocation(), ENT_QUOTES) . "</span>\n"
 
					. '<span class="synonym block">' . htmlentities($section->getSynonym(), ENT_QUOTES) . "</span>\n"
 
                                        . '<span class="credit-hours block">' . htmlentities($section_credit_hours, ENT_QUOTES) . ' Credits</span>' . PHP_EOL
 
					. "</td>\n";
 

	
 
				      /* for the ``Registration Codes'' dialogue: */
 
				      if (empty($permutations_courses[$j]))
 
					{
 
					  $singleton_course = new Course($course->getName(), $course->title_get());
 
					  $singleton_course->section_add($section, $course_slot->id_get());
 
					  $permutation_courses[$j] = $singleton_course->to_json_array();
 
					}
 

	
 
				      $filled = TRUE;
 
				    }
0 comments (0 inline, 0 general)