Attempt adding cancelled stops to train scraper
This commit is contained in:
parent
5785e4a98b
commit
1abb5155e3
3 changed files with 9 additions and 4 deletions
|
@ -37,9 +37,6 @@ namespace InfoferScraper.Models.Station {
|
|||
}
|
||||
|
||||
public interface IStationStatus : IStatus {
|
||||
new int Delay { get; }
|
||||
new bool Real { get; }
|
||||
public bool Cancelled { get; }
|
||||
public string? Platform { get; }
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,13 @@ namespace InfoferScraper.Models.Status {
|
|||
/// Determines whether delay was actually reported or is an approximation
|
||||
/// </summary>
|
||||
public bool Real { get; }
|
||||
|
||||
public bool Cancelled { get; }
|
||||
}
|
||||
|
||||
internal record Status : IStatus {
|
||||
public int Delay { get; set; }
|
||||
public bool Real { get; set; }
|
||||
public bool Cancelled { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,7 +201,12 @@ namespace InfoferScraper.Scrapers {
|
|||
statusElement.Text().WithCollapsedSpaces(replaceWith: " ")
|
||||
).Groups as IEnumerable<Group>).Skip(1).Select(group => group.Value);
|
||||
arrDep.MakeStatus(status => {
|
||||
status.Delay = string.IsNullOrEmpty(onTime) ? int.Parse(delay) : 0;
|
||||
if (string.IsNullOrEmpty(onTime) && delay == null) {
|
||||
status.Cancelled = true;
|
||||
}
|
||||
else {
|
||||
status.Delay = string.IsNullOrEmpty(onTime) ? int.Parse(delay) : 0;
|
||||
}
|
||||
status.Real = string.IsNullOrEmpty(approx);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue