diff --git a/Services/IcsExportService.cs b/Services/IcsExportService.cs index d725df4..21cab7d 100644 --- a/Services/IcsExportService.cs +++ b/Services/IcsExportService.cs @@ -71,12 +71,6 @@ namespace ShiftScheduler.Services var departure = DateTime.TryParse(transport.DepartureTime, out var dep) ? dep.ToString("HH:mm") : transport.DepartureTime; var arrival = DateTime.TryParse(transport.ArrivalTime, out var arr) ? arr.ToString("HH:mm") : transport.ArrivalTime; - var mainJourney = transport.Sections?.FirstOrDefault()?.Journey; - if (mainJourney != null) - { - return $"{mainJourney.Category} {mainJourney.Number}: {departure} → {arrival}"; - } - return $"{departure} → {arrival}"; } } diff --git a/Services/TransportApiService.cs b/Services/TransportApiService.cs index fd37755..b0422e5 100644 --- a/Services/TransportApiService.cs +++ b/Services/TransportApiService.cs @@ -51,37 +51,6 @@ namespace ShiftScheduler.Services ArrivalTime = apiConnection.To?.Arrival ?? string.Empty, Duration = apiConnection.Duration, Platform = apiConnection.From?.Platform ?? string.Empty, - Sections = apiConnection.Sections.Select(s => new TransportSection - { - Journey = s.Journey != null ? new TransportJourney - { - Name = s.Journey.Name, - Category = s.Journey.Category, - Number = s.Journey.Number - } : null, - Departure = s.Departure != null ? new TransportCheckpoint - { - Station = s.Departure.Station != null ? new TransportStation - { - Name = s.Departure.Station.Name, - Id = s.Departure.Station.Id - } : null, - Departure = s.Departure.Departure, - Arrival = s.Departure.Arrival, - Platform = s.Departure.Platform - } : null, - Arrival = s.Arrival != null ? new TransportCheckpoint - { - Station = s.Arrival.Station != null ? new TransportStation - { - Name = s.Arrival.Station.Name, - Id = s.Arrival.Station.Id - } : null, - Departure = s.Arrival.Departure, - Arrival = s.Arrival.Arrival, - Platform = s.Arrival.Platform - } : null - }).ToList() }; } } diff --git a/Shared/ShiftWithTransport.cs b/Shared/ShiftWithTransport.cs index ad11ace..e7ab5d0 100644 --- a/Shared/ShiftWithTransport.cs +++ b/Shared/ShiftWithTransport.cs @@ -1,6 +1,5 @@ namespace ShiftScheduler.Shared { - // View model that combines shift information with transport data for a specific date public record ShiftWithTransport { public DateTime Date { get; init; } @@ -24,11 +23,7 @@ namespace ShiftScheduler.Shared var departure = DateTime.TryParse(connection.DepartureTime, out var dep) ? dep.ToString("HH:mm") : connection.DepartureTime; var arrival = DateTime.TryParse(connection.ArrivalTime, out var arr) ? arr.ToString("HH:mm") : connection.ArrivalTime; - - var mainJourney = connection.Sections?.FirstOrDefault()?.Journey; - var trainInfo = mainJourney != null ? $"{mainJourney.Category}{mainJourney.Number}" : "Train"; - - return $"{trainInfo} {departure}→{arrival}"; + return $"{departure}→{arrival}"; } } } \ No newline at end of file diff --git a/Shared/TransportModels.cs b/Shared/TransportModels.cs index 9b14d26..078c17a 100644 --- a/Shared/TransportModels.cs +++ b/Shared/TransportModels.cs @@ -27,39 +27,10 @@ namespace ShiftScheduler.Shared public string ArrivalTime { get; set; } = string.Empty; public string Duration { get; set; } = string.Empty; public string? Platform { get; set; } = string.Empty; - public List Sections { get; set; } = new(); public override string ToString() { return $"{Platform}: {DepartureTime} - {ArrivalTime} ({Duration})"; } } - - public class TransportSection - { - public TransportJourney? Journey { get; set; } - public TransportCheckpoint? Departure { get; set; } - public TransportCheckpoint? Arrival { get; set; } - } - - public class TransportJourney - { - public string Name { get; set; } = string.Empty; - public string Category { get; set; } = string.Empty; - public string Number { get; set; } = string.Empty; - } - - public class TransportCheckpoint - { - public TransportStation? Station { get; set; } - public string? Departure { get; set; } = string.Empty; - public string? Arrival { get; set; } = string.Empty; - public string? Platform { get; set; } = string.Empty; - } - - public class TransportStation - { - public string Name { get; set; } = string.Empty; - public string Id { get; set; } = string.Empty; - } } \ No newline at end of file diff --git a/ShiftScheduler.Services.Tests/TransportApiServiceTests.cs b/ShiftScheduler.Services.Tests/TransportApiServiceTests.cs index e9487ca..29257b5 100644 --- a/ShiftScheduler.Services.Tests/TransportApiServiceTests.cs +++ b/ShiftScheduler.Services.Tests/TransportApiServiceTests.cs @@ -62,13 +62,6 @@ public class TransportApiServiceTests result.ArrivalTime.ShouldBe("2023-12-15T07:30:00"); result.Duration.ShouldBe("00:45:00"); result.Platform.ShouldBe("5"); - result.Sections.ShouldNotBeEmpty(); - result.Sections.Count.ShouldBe(1); - - var section = result.Sections.First(); - section.Journey?.Name.ShouldBe("IC 1"); - section.Journey?.Category.ShouldBe("IC"); - section.Journey?.Number.ShouldBe("1"); } [Fact]