Skip to content

Commit

Permalink
Update service day map
Browse files Browse the repository at this point in the history
  • Loading branch information
chunlaw committed Sep 21, 2023
1 parent 39fbfe6 commit 9af0882
Show file tree
Hide file tree
Showing 2 changed files with 516 additions and 20 deletions.
22 changes: 2 additions & 20 deletions src/timetable.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Freq } from "hk-bus-eta";
import { ServiceDayMap } from "./utils";

export const ServiceIds = {
"31": "星期一至五",
Expand All @@ -19,26 +20,6 @@ export const ServiceIds = {
"111": "除星期三外",
};

const ServiceDayMap = {
// from sunday to monday
"266": [0, 0, 1, 1, 1, 0, 0],
"271": [0, 1, 1, 1, 1, 0, 0],
"272": [0, 0, 0, 0, 0, 1, 0],
"287": [0, 1, 1, 1, 1, 1, 0],
"288": [0, 0, 0, 0, 0, 0, 1],
"319": [0, 1, 1, 1, 1, 1, 1],
"320": [1, 0, 0, 0, 0, 0, 0],
"415": [0, 1, 1, 1, 1, 1, 0],
"416": [1, 0, 0, 0, 0, 0, 1],
"447": [0, 1, 1, 1, 1, 1, 1],
"448": [1, 0, 0, 0, 0, 0, 0],
"480": [1, 0, 0, 0, 0, 0, 1],
"511": [1, 1, 1, 1, 1, 1, 1],
"31": [0, 1, 1, 1, 1, 1, 0],
"63": [0, 1, 1, 1, 1, 1, 1],
"111": [1, 1, 0, 1, 1, 1, 1],
};

// return minute offset start from sunday 00:00
const getWeeklyTimestamp = (day: number, dayTime: string): number => {
let ret = day * 24 * 60;
Expand Down Expand Up @@ -98,6 +79,7 @@ export const isRouteAvaliable = (
});
} catch (e) {
console.log(routeNo + " has unknown service ID");
isAvailable = true;
}
});
return isAvailable;
Expand Down
Loading

0 comments on commit 9af0882

Please sign in to comment.