Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change UpdateDateTime type for IntervalDataRecord #14

Merged
merged 1 commit into from
Sep 16, 2024
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
5 changes: 3 additions & 2 deletions src/AEMO.MDFF.Tests/NEM12/BasicTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public async Task Test1()
case NMIDataDetailsRecord { NextScheduledReadDate: var nsrd }:
_testOutputHelper.WriteLine(nsrd.ToLongDateString());
break;
case IntervalDataRecord { IntervalValues: var ivs }:
_testOutputHelper.WriteLine(ivs.ToString());
case IntervalDataRecord intervalDataRecord:
_testOutputHelper.WriteLine(intervalDataRecord.IntervalValues.ToString());
_testOutputHelper.WriteLine(intervalDataRecord.UpdateDateTime.ToLongTimeString());
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/AEMO.MDFF/NEM12/IntervalDataRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
{
public string RecordIndicator => "300";
public DateOnly IntervalDate { get; set; }
public IReadOnlyCollection<decimal> IntervalValues { get; set; }

Check warning on line 9 in src/AEMO.MDFF/NEM12/IntervalDataRecord.cs

View workflow job for this annotation

GitHub Actions / build (8.x)

Non-nullable property 'IntervalValues' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
public string QualityMethod { get; set; }
public string ReasonCode { get; set; }
public string ReasonDescription { get; set; }
public string UpdateDateTime { get; set; }
public DateTime UpdateDateTime { get; set; }
public DateTime MSATSLoadDateTime { get; set; }
}
9 changes: 5 additions & 4 deletions src/AEMO.MDFF/NEM12/Nem12Reader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ private NMIDataDetailsRecord ParseNMIDataDetailsRecord(CsvDataReader csv)

private IntervalDataRecord ParseIntervalDataRecord(CsvDataReader csv, string currentNMI)
{
var dateString = csv.GetString(1);
var date = DateOnly.ParseExact(dateString, "yyyyMMdd", CultureInfo.InvariantCulture);
var intervalDate = DateOnly.ParseExact(csv.GetString(1), "yyyyMMdd", CultureInfo.InvariantCulture);
int intervalLength = _nmiIntervalLengths[currentNMI];
int expectedIntervals = 1440 / intervalLength; // 1440 minutes in a day
var updateDateTime = DateTime.ParseExact(csv.GetString(2 + expectedIntervals + 3), "yyyyMMddHHmmss", CultureInfo.InvariantCulture);

var intervalValues = new List<decimal>();
for (int i = 2; i < expectedIntervals + 2; i++)
Expand All @@ -118,8 +118,9 @@ private IntervalDataRecord ParseIntervalDataRecord(CsvDataReader csv, string cur

return new IntervalDataRecord
{
IntervalDate = date,
IntervalValues = intervalValues
IntervalDate = intervalDate,
IntervalValues = intervalValues,
UpdateDateTime = updateDateTime,
};
}
}
Loading