Browse Source

fix saving dynamic start time (#453)

pull/455/head
Jason Dove 5 years ago committed by GitHub
parent
commit
417f35a834
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CHANGELOG.md
  2. 13
      ErsatzTV.Application/ProgramSchedules/Commands/ProgramScheduleItemCommandBase.cs

2
CHANGELOG.md

@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- Fix saving dynamic start time on schedule items
## [0.2.0-alpha] - 2021-10-23
### Fixed

13
ErsatzTV.Application/ProgramSchedules/Commands/ProgramScheduleItemCommandBase.cs

@ -169,7 +169,7 @@ namespace ErsatzTV.Application.ProgramSchedules.Commands @@ -169,7 +169,7 @@ namespace ErsatzTV.Application.ProgramSchedules.Commands
{
ProgramScheduleId = programSchedule.Id,
Index = index,
StartTime = FixDuration(item.StartTime.GetValueOrDefault()),
StartTime = FixStartTime(item.StartTime),
CollectionType = item.CollectionType,
CollectionId = item.CollectionId,
MultiCollectionId = item.MultiCollectionId,
@ -188,7 +188,7 @@ namespace ErsatzTV.Application.ProgramSchedules.Commands @@ -188,7 +188,7 @@ namespace ErsatzTV.Application.ProgramSchedules.Commands
{
ProgramScheduleId = programSchedule.Id,
Index = index,
StartTime = FixDuration(item.StartTime.GetValueOrDefault()),
StartTime = FixStartTime(item.StartTime),
CollectionType = item.CollectionType,
CollectionId = item.CollectionId,
MultiCollectionId = item.MultiCollectionId,
@ -207,7 +207,7 @@ namespace ErsatzTV.Application.ProgramSchedules.Commands @@ -207,7 +207,7 @@ namespace ErsatzTV.Application.ProgramSchedules.Commands
{
ProgramScheduleId = programSchedule.Id,
Index = index,
StartTime = FixDuration(item.StartTime.GetValueOrDefault()),
StartTime = FixStartTime(item.StartTime),
CollectionType = item.CollectionType,
CollectionId = item.CollectionId,
MultiCollectionId = item.MultiCollectionId,
@ -227,7 +227,7 @@ namespace ErsatzTV.Application.ProgramSchedules.Commands @@ -227,7 +227,7 @@ namespace ErsatzTV.Application.ProgramSchedules.Commands
{
ProgramScheduleId = programSchedule.Id,
Index = index,
StartTime = FixDuration(item.StartTime.GetValueOrDefault()),
StartTime = FixStartTime(item.StartTime),
CollectionType = item.CollectionType,
CollectionId = item.CollectionId,
MultiCollectionId = item.MultiCollectionId,
@ -249,5 +249,10 @@ namespace ErsatzTV.Application.ProgramSchedules.Commands @@ -249,5 +249,10 @@ namespace ErsatzTV.Application.ProgramSchedules.Commands
private static TimeSpan FixDuration(TimeSpan duration) =>
duration >= TimeSpan.FromDays(1) ? duration.Subtract(TimeSpan.FromDays(1)) : duration;
private static TimeSpan? FixStartTime(TimeSpan? startTime) =>
startTime.HasValue && startTime.Value >= TimeSpan.FromDays(1)
? startTime.Value.Subtract(TimeSpan.FromDays(1))
: startTime;
}
}

Loading…
Cancel
Save