Skip to content

Commit

Permalink
Minor bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollo3zehn committed Sep 11, 2023
1 parent 2bbf718 commit 2921481
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v2.0.0-beta.9 - 2023-09-11

- Minor bug fix.

## v2.0.0-beta.8 - 2023-09-11

- Do not catch OutOfMemory Exceptions.
Expand Down
26 changes: 24 additions & 2 deletions src/Nexus.Sources.StructuredFile/StructuredFileDataSource.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using Microsoft.Extensions.Logging;
using Nexus.DataModel;
Expand Down Expand Up @@ -370,8 +371,29 @@ protected virtual async Task ReadAsync(
var filePaths = await FindFilePathsAsync(currentBegin, fileSource);

// determine file begin
if (!TryGetFileBeginByPath(filePaths.First(), fileSource, out var fileBegin, folderBegin: default))
throw new Exception($"Unable to determine date/time of file {filePaths.First()}.");
DateTime fileBegin;

if (filePaths.Any())
{
if (!TryGetFileBeginByPath(filePaths.First(), fileSource, out fileBegin, folderBegin: default))
throw new Exception($"Unable to determine date/time of file {filePaths.First()}.");
}

else
{
// TODO: Test this code path
// determine begin of missing file
var localBegin = begin.Kind switch
{
DateTimeKind.Local => begin,
DateTimeKind.Utc => DateTime.SpecifyKind(begin.Add(fileSource.UtcOffset), DateTimeKind.Local),
_ => throw new ArgumentException("The begin parameter must have its kind property specified.")
};

var roundedLocalBegin = localBegin.RoundDown(fileSource.FilePeriod);

fileBegin = AdjustToUtc(roundedLocalBegin, fileSource.UtcOffset);
}

/* CB = Current Begin, FP = File Period
*
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "2.0.0",
"suffix": "beta.8"
"suffix": "beta.9"
}

0 comments on commit 2921481

Please sign in to comment.