# HG changeset patch # User Nathan Phillip Brink # Date 2011-03-29 21:47:40 # Node ID 933c98416373d7974e1cd3458ce41d0f9f67679b # Parent 6e6ed7aaca3b3406fdebeb02a21280b56bd3a1fd Support very early morning and late night classes much better. Fixes bug 101. diff --git a/inc/class.schedule.php b/inc/class.schedule.php --- a/inc/class.schedule.php +++ b/inc/class.schedule.php @@ -391,12 +391,16 @@ class Schedule /* very late / very early classes */ while ($meeting->getEndTime() > $max_time) { - $max_time += 30; + $max_time = sprintf("%04d", $max_time + 30); + while (substr($max_time, -2) >= 60) + $max_time = sprintf("%02d%02d", substr($max_time, 0, 2) + 1, substr($max_time, -2) - 60); $time[] = $max_time; } while ($meeting->getStartTime() < $min_time) { - $min_time -= 30; + if (substr($min_time, -2) < 30) + $min_time = sprintf("%02d%02d", substr($min_time, 0, 2) - 1, substr($min_time, -2) + 60); + $min_time = sprintf("%04d", $min_time - 30); $time[] = $min_time; $sort_time = TRUE; } diff --git a/scripts/scheduleInput.js b/scripts/scheduleInput.js --- a/scripts/scheduleInput.js +++ b/scripts/scheduleInput.js @@ -133,7 +133,9 @@ function add_section_n(cnum, name, synon if (stime.length > 0) { var stime_end = stime.substr(2); - if (stime_end != '00' && stime_end != '30') + var stime_begin = stime.substr(0, 2); + if (stime_end != '00' && stime_end != '30' + || stime_begin < 7 || stime_begin > 21) section_html = section_html + genOptionHtml(stime, prettyTime(stime), stime); } @@ -158,7 +160,9 @@ function add_section_n(cnum, name, synon if (etime.length > 0) { var etime_end = etime.substr(2); - if (etime_end != '50' && etime_end != '20') + var etime_begin = etime.substr(0, 2); + if (etime_end != '50' && etime_end != '20' + || etime_begin < 7 || etime_begin > 21) section_html = section_html + genOptionHtml(etime, prettyTime(etime), etime); } @@ -174,7 +178,6 @@ function add_section_n(cnum, name, synon '' + ''; - jQuery('.pclass' + cnum).after(section_html); sectionsOfClass[cnum] ++;