Compare commits
2 Commits
6c149e844b
...
4056b3a739
Author | SHA1 | Date | |
---|---|---|---|
4056b3a739
|
|||
f7f0fdb980
|
@@ -31,6 +31,10 @@ class IdfmInterface:
|
||||
async def startup(self) -> None:
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def _format_line_id(line_id: str) -> int:
|
||||
return int(line_id[1:] if line_id[0] == "C" else line_id)
|
||||
|
||||
async def render_line_picto(self, line: Line) -> tuple[None | str, None | str]:
|
||||
line_picto_path = line_picto_format = None
|
||||
target = f"/tmp/{line.id}_repr"
|
||||
@@ -81,7 +85,6 @@ class IdfmInterface:
|
||||
|
||||
if (stop := await Stop.get_by_id(stop_id)) is not None:
|
||||
expected_stop_ids = {stop.id}
|
||||
|
||||
elif (stop_area := await StopArea.get_by_id(stop_id)) is not None:
|
||||
expected_stop_ids = {stop.id for stop in stop_area.stops}
|
||||
else:
|
||||
@@ -105,7 +108,8 @@ class IdfmInterface:
|
||||
if (
|
||||
dst_names := journey.DestinationName
|
||||
) and monitored_stop_id in expected_stop_ids:
|
||||
line_id = journey.LineRef.value.split(":")[-2]
|
||||
raw_line_id = journey.LineRef.value.split(":")[-2]
|
||||
line_id = IdfmInterface._format_line_id(raw_line_id)
|
||||
destinations[line_id].add(dst_names[0].value)
|
||||
|
||||
return destinations
|
||||
|
@@ -53,8 +53,8 @@ class Line(BaseModel):
|
||||
transportMode: TransportMode
|
||||
backColorHexa: str
|
||||
foreColorHexa: str
|
||||
operatorId: str
|
||||
operatorId: int
|
||||
accessibility: IdfmState
|
||||
visualSignsAvailable: IdfmState
|
||||
audibleSignsAvailable: IdfmState
|
||||
stopIds: list[str]
|
||||
stopIds: list[int]
|
||||
|
@@ -9,7 +9,7 @@ class Stop(BaseModel):
|
||||
town: str
|
||||
epsg3857_x: float
|
||||
epsg3857_y: float
|
||||
lines: list[str]
|
||||
lines: list[int]
|
||||
|
||||
|
||||
class StopArea(BaseModel):
|
||||
@@ -17,7 +17,7 @@ class StopArea(BaseModel):
|
||||
name: str
|
||||
town: str
|
||||
type: StopAreaType
|
||||
lines: list[str] # SNCF lines are linked to stop areas and not stops.
|
||||
lines: list[int] # SNCF lines are linked to stop areas and not stops.
|
||||
stops: list[Stop]
|
||||
|
||||
|
||||
|
@@ -116,8 +116,10 @@ export const Map: ParentComponent<{}> = () => {
|
||||
const foundStopIds = new Set();
|
||||
for (const foundStop of stops) {
|
||||
foundStopIds.add(foundStop.id);
|
||||
if (foundStop.stops !== undefined) {
|
||||
foundStop.stops.forEach(s => foundStopIds.add(s.id));
|
||||
}
|
||||
}
|
||||
|
||||
for (const [stopIdStr, feature] of Object.entries(displayedFeatures)) {
|
||||
const stopId = parseInt(stopIdStr);
|
||||
|
@@ -8,7 +8,7 @@ export enum TrafficStatus {
|
||||
|
||||
export class Passage {
|
||||
line: number;
|
||||
operator: string;
|
||||
operator: number;
|
||||
destinations: string[];
|
||||
atStop: boolean;
|
||||
aimedArrivalTs: number;
|
||||
@@ -19,7 +19,7 @@ export class Passage {
|
||||
arrivalStatus: string;
|
||||
departStatus: string;
|
||||
|
||||
constructor(line: number, operator: string, destinations: string[], atStop: boolean, aimedArrivalTs: number,
|
||||
constructor(line: number, operator: number, destinations: string[], atStop: boolean, aimedArrivalTs: number,
|
||||
expectedArrivalTs: number, arrivalPlatformName: string, aimedDepartTs: number, expectedDepartTs: number,
|
||||
arrivalStatus: string, departStatus: string) {
|
||||
this.line = line;
|
||||
@@ -45,9 +45,9 @@ export class Stop {
|
||||
epsg3857_x: number;
|
||||
epsg3857_y: number;
|
||||
stops: Stop[];
|
||||
lines: string[];
|
||||
lines: number[];
|
||||
|
||||
constructor(id: number, name: string, town: string, epsg3857_x: number, epsg3857_y: number, stops: Stop[], lines: string[]) {
|
||||
constructor(id: number, name: string, town: string, epsg3857_x: number, epsg3857_y: number, stops: Stop[], lines: number[]) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.town = town;
|
||||
@@ -82,7 +82,7 @@ export class StopShape {
|
||||
export type StopShapes = Record<number, StopShape>;
|
||||
|
||||
export class Line {
|
||||
id: string;
|
||||
id: number;
|
||||
shortName: string;
|
||||
name: string;
|
||||
status: string; // TODO: Use an enum
|
||||
@@ -95,7 +95,7 @@ export class Line {
|
||||
audibleSignsAvailable: string; // TODO: Use an enum
|
||||
stopIds: number[];
|
||||
|
||||
constructor(id: string, shortName: string, name: string, status: string, transportMode: string, backColorHexa: string,
|
||||
constructor(id: number, shortName: string, name: string, status: string, transportMode: string, backColorHexa: string,
|
||||
foreColorHexa: string, operatorId: number, accessibility: boolean, visualSignsAvailable: string,
|
||||
audibleSignsAvailable: string, stopIds: number[]) {
|
||||
this.id = id;
|
||||
|
Reference in New Issue
Block a user