Skip to content

Commit

Permalink
Merge pull request #172 from jannikbecker/staging
Browse files Browse the repository at this point in the history
Version 0.5.3
  • Loading branch information
jannikbecker authored Jan 24, 2022
2 parents 2d458dd + 20c9f08 commit e79f3ce
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 36 deletions.
4 changes: 4 additions & 0 deletions Leibit.BLL/LiveDataBLL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ public OperationResult<bool> SetExpectedDelay(LiveSchedule schedule, int? expect
if (expectedDelayDeparture.HasValue)
schedule.ExpectedDelayDeparture = expectedDelayDeparture;

schedule.IsManuallyModified = true;

var calculationResult = CalculationBLL.CalculateExpectedTimes(schedule.Train, schedule.Schedule.Station.ESTW);
ValidateResult(calculationResult);

Expand Down Expand Up @@ -290,6 +292,8 @@ public OperationResult<bool> ChangeTrack(LiveSchedule schedule, Track track)
else
schedule.LiveTrack = track;

schedule.IsManuallyModified = true;

__SynchronizeTwinSchedules(schedule.Train, schedule.Schedule.Station.ESTW);

var result = new OperationResult<bool>();
Expand Down
27 changes: 16 additions & 11 deletions Leibit.BLL/SerializationBLL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public OperationResult<SerializedRoot> Save(string Filename, SerializationContai
SerializedSchedule.IsComposed = Schedule.IsComposed;
SerializedSchedule.IsPrepared = Schedule.IsPrepared;
SerializedSchedule.IsCancelled = Schedule.IsCancelled;
SerializedSchedule.IsManuallyModified = Schedule.IsManuallyModified;

if (Schedule.LiveTrack != null)
SerializedSchedule.LiveTrack = Schedule.LiveTrack.Name;
Expand Down Expand Up @@ -236,7 +237,7 @@ public OperationResult<SerializationContainer> Open(string Filename)
{
var Estw = Area.ESTWs.SingleOrDefault(e => e.Id == SerializedTrain.CurrentEstwId);

if (Estw == null || !Estw.IsLoaded || !Area.Trains.ContainsKey(SerializedTrain.TrainNumber))
if (Estw?.IsLoaded == false || !Area.Trains.ContainsKey(SerializedTrain.TrainNumber))
continue;

var Train = Area.Trains[SerializedTrain.TrainNumber];
Expand All @@ -260,10 +261,10 @@ public OperationResult<SerializationContainer> Open(string Filename)
}
}

if (Estw.Blocks.ContainsKey(SerializedTrain.Block))
if (SerializedTrain.Block != null && Estw.Blocks.ContainsKey(SerializedTrain.Block))
LiveTrain.Block = Estw.Blocks[SerializedTrain.Block].FirstOrDefault(b => b.Direction == SerializedTrain.BlockDirection);

var SchedulesResult = CalculationBll.GetSchedulesByTime(Train.Schedules, Estw.Time);
var SchedulesResult = CalculationBll.GetSchedulesByTime(Train.Schedules, Estw?.Time ?? SerializedTrain.LastModified);
ValidateResult(SchedulesResult);

foreach (var SerializedSchedule in SerializedTrain.Schedules)
Expand All @@ -285,6 +286,7 @@ public OperationResult<SerializationContainer> Open(string Filename)
LiveSchedule.IsComposed = SerializedSchedule.IsComposed;
LiveSchedule.IsPrepared = SerializedSchedule.IsPrepared;
LiveSchedule.IsCancelled = SerializedSchedule.IsCancelled;
LiveSchedule.IsManuallyModified = SerializedSchedule.IsManuallyModified;

if (SerializedSchedule.ExpectedDelay.HasValue)
{
Expand Down Expand Up @@ -316,14 +318,17 @@ public OperationResult<SerializationContainer> Open(string Filename)
LiveTrain.AddSchedule(LiveSchedule);
}

// Don't validate result here. When this fails, it's not so dramatic...
var prevResult = CalculationBll.GetPreviousService(Train, Estw);
if (prevResult.Succeeded)
LiveTrain.PreviousService = prevResult.Result;

var followUpResult = CalculationBll.GetFollowUpService(Train, Estw);
if (followUpResult.Succeeded)
LiveTrain.FollowUpService = followUpResult.Result;
if (Estw != null)
{
// Don't validate result here. When this fails, it's not so dramatic...
var prevResult = CalculationBll.GetPreviousService(Train, Estw);
if (prevResult.Succeeded)
LiveTrain.PreviousService = prevResult.Result;

var followUpResult = CalculationBll.GetFollowUpService(Train, Estw);
if (followUpResult.Succeeded)
LiveTrain.FollowUpService = followUpResult.Result;
}

if (LiveTrain.Schedules.Any())
Area.LiveTrains.TryAdd(Train.Number, LiveTrain);
Expand Down
2 changes: 1 addition & 1 deletion Leibit.Client.WPF/Leibit.Client.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
<Version>0.5.2</Version>
<Version>0.5.3</Version>
<PackageProjectUrl>https://github.com/jannikbecker/leibit</PackageProjectUrl>
<RepositoryUrl>https://github.com/jannikbecker/leibit</RepositoryUrl>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected List<ScheduleItem> GetScheduleCandidates(Area area, int leadMinutes, b
if (referenceTime > currentTime.AddMinutes(leadMinutes))
continue;

if (liveSchedule.Train.Schedules.All(s => !s.IsArrived) && liveSchedule.Train.LastModified < schedule.Station.ESTW.Time)
if (referenceTime < currentTime && liveSchedule.Train.LastModified < currentTime)
continue;

candidates.Add(new ScheduleItem(referenceTime, schedule, liveSchedule));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,8 @@ internal override void Refresh(Area area)
{
int? followUpService = __GetFollowUpService(currentItem);

if (followUpService.HasValue && area.Trains.ContainsKey(followUpService.Value) && !IsInTwinTrainMode)
if (followUpService.HasValue && area.Trains.TryGetValue(followUpService.Value, out var followUpTrain) && followUpTrain.Type.IsPassengerTrain() && !IsInTwinTrainMode)
{
var followUpTrain = area.Trains[followUpService.Value];
infoTexts.Add($"Dieser Zug endet hier und fährt weiter als {followUpTrain.Type} {followUpTrain.Number} nach {followUpTrain.Destination}");
Via = string.Empty;
CurrentTrainDestination = $"von {currentItem.Schedule.Start}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ Scheduled time | Visible | Reason
return false;
}

if (liveSchedule.Train.Schedules.All(s => !s.IsArrived) && liveSchedule.Train.LastModified < schedule.Station.ESTW.Time)
if (liveSchedule.Train.Schedules.All(s => !s.IsArrived) && liveSchedule.Train.LastModified < schedule.Station.ESTW.Time && !liveSchedule.IsManuallyModified)
return false;

return true;
Expand Down
2 changes: 1 addition & 1 deletion Leibit.Core/Data/berlin/B-Stadtbahn.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
</track>
</station>

<station name="Berlin Alexanderplatz Hp" short="BALEF" refNr="13" scheduleFile="b13_____.abf" displayName="B Alexanderplatz">
<station name="Berlin Alexanderplatz Hp" short="BALEF" refNr="12" scheduleFile="b12_____.abf" displayName="B Alexanderplatz">
<track name="1" calculateDelay="false">
<block name="12B12"/>
</track>
Expand Down
17 changes: 16 additions & 1 deletion Leibit.Core/Data/passenger_trains.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"trainTypes": [
"CIS",
"CNL",
"D",
"DNR",
"DPV",
"DRV",
"DZ",
"E",
"EC",
Expand All @@ -14,15 +17,27 @@
"IR",
"IRE",
"MET",
"NJ",
"NWB",
"NZ",
"NZT",
"OEC",
"OIC",
"R",
"RB",
"RE",
"REX",
"RGJ",
"RJ",
"RSB",
"S",
"SB",
"SD",
"SDZ",
"SE",
"SR",
"STB",
"UEX"
"UEX",
"WB"
]
}
24 changes: 12 additions & 12 deletions Leibit.Core/Data/sued/MKP.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@
</station>

<station name="Vils" short="XAV" refNr="7" scheduleFile="g7______.abf" localOrderFile="bf7_____.abf">
<track name="001">
<block name="07G001"/>
<track name="201">
<block name="07G201"/>
</track>
<track name="003">
<block name="07G003"/>
<track name="203">
<block name="07G203"/>
</track>
</station>

Expand All @@ -294,17 +294,17 @@
</station>

<station name="Reutte in Tirol" short="XART" refNr="8" scheduleFile="g8______.abf" localOrderFile="bf8_____.abf">
<track name="001" displayName="1">
<block name="08G001"/>
<track name="201" displayName="1">
<block name="08G201"/>
</track>
<track name="002" displayName="2">
<block name="08G002"/>
<track name="202" displayName="2">
<block name="08G202"/>
</track>
<track name="003" displayName="3">
<block name="08G003"/>
<track name="203" displayName="3">
<block name="08G203"/>
</track>
<track name="004" displayName="4">
<block name="08G004"/>
<track name="204" displayName="4">
<block name="08G204"/>
</track>
</station>

Expand Down
2 changes: 2 additions & 0 deletions Leibit.Entities/LiveData/LiveSchedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public LeibitTime ExpectedDeparture

public bool IsCancelled { get; set; }

public bool IsManuallyModified { get; set; }

public ReadOnlyCollection<DelayInfo> Delays
{
get
Expand Down
1 change: 1 addition & 0 deletions Leibit.Entities/Serialization/SerializedSchedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ public SerializedSchedule()
public bool IsComposed { get; set; }
public bool IsPrepared { get; set; }
public bool IsCancelled { get; set; }
public bool IsManuallyModified { get; set; }
}
}
Binary file modified assets/ESTWonline.zip
Binary file not shown.
13 changes: 7 additions & 6 deletions assets/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
Die Datei *Setup.exe* herunterladen und ausführen. Nach wenigen Sekunden startet LeiBIT.

# Neue Funktionen in dieser Version
- Das ESTW Berlin-Stadtbahn steht nun zur Verfügung (#54).
- LeiBIT zeigt nun Vorgänger- und Folgeleistungen im Zuglauf und auf den Zugzielanzeigern an (#151).
- Die Fahrgastinformationsdisplays zeigen nun keine Güterzüge und Leerfahrten mehr an (#146).
- Es können nun auch Gleiswechsel und voraussichtliche Verspätungen für Züge eingegeben werden, die noch nicht im Stellbereich sind (#145).
- Im Zuglauf können Zugausfälle und Teilausfälle eingegeben werden (#147).
- Korrekturen und Verbesserungen in kleinerem Umfang
In dieser Version wurden diverse Fehler korrigiert.
- Fehlerhafte Fahrplandatei in Berlin Alexanderplatz korrigiert (#167)
- Gleisbezeichnungen in Vils und Reutte korrigiert (#166)
- Österreichische und schweizerische Personenzuggattungen ergänzt (#161, #169)
- Darstellung von Wenden auf Leerfahrten verbessert (#163)
- Züge verschwinden nicht mehr aus der ZFI, wenn man einen Gleiswechsel oder eine voraussichtliche Verspätung eingegeben hat. (#162)
- ESTWonline auf Version 2.6.5 aktualisiert (#168)

0 comments on commit e79f3ce

Please sign in to comment.