Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions cpap-lib/DailyReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,24 @@ public void UpdateSignalStatistics( string signalName )
/// </summary>
public void RefreshTimeRange()
{
RecordingStartTime = Sessions.Min( x => x.StartTime );
RecordingEndTime = Sessions.Max( x => x.EndTime );
TotalSleepTime = CalculateTotalSleepTime();
}
if (Sessions.Count != 0)
{
RecordingStartTime = Sessions.Min(x => x.StartTime);
RecordingEndTime = Sessions.Max(x => x.EndTime);
TotalSleepTime = CalculateTotalSleepTime();
}
else
{
// If there are no sessions, reset the time range values to their defaults.

// It's a bug to call this function when there are no sessions, but we'll handle it gracefully.
// Without this check, an exception would be thrown.

RecordingStartTime = default;
RecordingEndTime = default;
TotalSleepTime = default;
}
}

/// <summary>
/// Adds a new Session to the Sessions list and updates the RecordingStartTime and RecordingEndTime
Expand Down
Loading
Loading