From: Maxious Date: Wed, 25 Jan 2012 06:42:53 +0000 Subject: Public holiday consideration in myway timeliness X-Git-Url: https://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=cc4df63ea6f8af444d8981d660458fc63a539429 --- Public holiday consideration in myway timeliness --- --- a/myway/myway_timeliness_calculate.php +++ b/myway/myway_timeliness_calculate.php @@ -58,10 +58,18 @@ $search_time = date("H:i:s", strtotime($obsv['time']) - (60 * 60)); // 30 minutes margin $date = date("c", strtotime($obsv['time'])); $timing_period = service_period(strtotime($date)); + + // little hack for public holidays nolonger active; weekdays and 900+ route numbers don't make sense + if ($timing_period == "weekday" && preg_match('/9../',$obsv["route_short_name"])) { + echo "Potential public holiday detected, trying Sunday timetable.
"; + + $timing_period = "sunday"; + } + if (isset($obsv["stop_id"]) && $obsv["stop_id"] != "" && $obsv["stop_id"] != "*") { $potentialStops = Array(getStop($obsv["stop_id"])); } else { - echo "Potential stops are a bus station
"; + echo "No stop_id recorded for this stop_name, potential stops are a bus station
"; $potentialStops = getStops("", trim(str_replace(Array("Arrival","Arrivals","Arrive Platform 3 Set down only.","Arrive","Set Down Only"), "", $obsv["myway_stop"]))); } //:get myway_stops records --- a/stop.php +++ b/stop.php @@ -73,9 +73,12 @@ //} } } +if (sizeof($stops) > 0) { $stopDescParts = explode("
",$stop['stop_desc']); include_header(trim(str_replace("Street: ","",$stopDescParts[0])), "stop"); - +} else { + include_header($stop['stop_name']); +} /* $serviceAlerts = json_decode(getPage(curPageURL() . "/servicealerts_api.php?filter_class=stop&filter_id=".$stopid) , true); foreach($serviceAlerts['entities'] as $serviceAlert) {