mirror of
				https://github.com/public-transport/db-vendo-client.git
				synced 2025-10-24 21:56:32 +03:00 
			
		
		
		
	mark journeys & journey parts as cancelled
see derhuerst/vbb-gtfs#19 see public-transport/friend-public-transport-format#27
This commit is contained in:
		
							parent
							
								
									817f44ea39
								
							
						
					
					
						commit
						658d67e3b2
					
				
					 2 changed files with 16 additions and 1 deletions
				
			
		|  | @ -78,6 +78,15 @@ const createParseJourneyPart = (profile, stations, lines, remarks) => { | |||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		// todo: follow public-transport/friendly-public-transport-format#27 here
 | ||||
| 		// see also derhuerst/vbb-rest#19
 | ||||
| 		if (pt.arr.dCncl && pt.dep.dCncl) { | ||||
| 			result.cancelled = true | ||||
| 			result.departure = result.departurePlatform = null | ||||
| 			result.arrival = result.arrivalPlatform = null | ||||
| 			result.delay = null | ||||
| 		} | ||||
| 
 | ||||
| 		return res | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,13 +15,19 @@ const createParseJourney = (profile, stations, lines, remarks) => { | |||
| 	// todo: use computed information from part
 | ||||
| 	const parseJourney = (j) => { | ||||
| 		const parts = j.secL.map(part => parsePart(j, part)) | ||||
| 		return { | ||||
| 		const res = { | ||||
| 			parts, | ||||
| 			origin: parts[0].origin, | ||||
| 			destination: parts[parts.length - 1].destination, | ||||
| 			departure: parts[0].departure, | ||||
| 			arrival: parts[parts.length - 1].arrival | ||||
| 		} | ||||
| 		if (parts.some(p => p.cancelled)) { | ||||
| 			res.cancelled = true | ||||
| 			res.departure = res.arrival = null | ||||
| 		} | ||||
| 
 | ||||
| 		return res | ||||
| 	} | ||||
| 
 | ||||
| 	return parseJourney | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue