Don't return departures with negative countdown
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Build image / build-image (push) Successful in 3m23s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Build image / build-image (push) Successful in 3m23s
				
			This commit is contained in:
		
							parent
							
								
									cf7bb96517
								
							
						
					
					
						commit
						16f7d80677
					
				| @ -16,7 +16,7 @@ | |||||||
| 
 | 
 | ||||||
|     vrnp-static = pkgs.buildGoModule { |     vrnp-static = pkgs.buildGoModule { | ||||||
|       pname = "vrnp"; |       pname = "vrnp"; | ||||||
|       version = "0.0.4"; |       version = "0.0.5"; | ||||||
|       vendorHash = null; |       vendorHash = null; | ||||||
| 
 | 
 | ||||||
|       # For building the package, we use only the files not ignored by Git as inputs. |       # For building the package, we use only the files not ignored by Git as inputs. | ||||||
|  | |||||||
							
								
								
									
										10
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								main.go
									
									
									
									
									
								
							| @ -117,6 +117,12 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures, | |||||||
| 			return Departures{}, errors.New("could not parse countdown") | 			return Departures{}, errors.New("could not parse countdown") | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | 		matchesPlatform := allowedPlatform == nil || d.Platform == *allowedPlatform | ||||||
|  | 		isInThePast := countdown < 0 | ||||||
|  | 		if !matchesPlatform || isInThePast { | ||||||
|  | 			continue | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 		if countdown == 0 { | 		if countdown == 0 { | ||||||
| 			leaving = "sofort" | 			leaving = "sofort" | ||||||
| 		} | 		} | ||||||
| @ -128,10 +134,6 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures, | |||||||
| 			leaving = fmt.Sprintf("%02s:%02s", dt.Hour, dt.Minute) | 			leaving = fmt.Sprintf("%02s:%02s", dt.Hour, dt.Minute) | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if allowedPlatform != nil && d.Platform != *allowedPlatform { |  | ||||||
| 			continue |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		ds = append(ds, Departure{ | 		ds = append(ds, Departure{ | ||||||
| 			d.Platform, | 			d.Platform, | ||||||
| 			d.ServingLine.Symbol, | 			d.ServingLine.Symbol, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user