diff --git a/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportListHttpTrigger.cs b/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportListHttpTrigger.cs index 01a1700..dcbbff4 100644 --- a/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportListHttpTrigger.cs +++ b/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportListHttpTrigger.cs @@ -99,19 +99,19 @@ private async Task> CheckStatusOfSettl { var updatedReport = settlementReport; - var instanceInfo = await durableTaskClient - .GetInstanceAsync(settlementReport.RequestId.Id, getInputsAndOutputs: true) - .ConfigureAwait(false); - - if (instanceInfo == null) + if (settlementReport.Status == SettlementReportStatus.InProgress && settlementReport.JobId == null) { - // If the orchestration instance is not found, we assume it is running on the other orchestration, - // either the heavy or the light one - continue; - } + var instanceInfo = await durableTaskClient + .GetInstanceAsync(settlementReport.RequestId.Id, getInputsAndOutputs: true) + .ConfigureAwait(false); + + if (instanceInfo == null) + { + // If the orchestration instance is not found, we assume it is running on the other orchestration, + // either the heavy or the light one + continue; + } - if (settlementReport.Status == SettlementReportStatus.InProgress) - { if (instanceInfo.RuntimeStatus is OrchestrationRuntimeStatus.Terminated or OrchestrationRuntimeStatus.Failed) diff --git a/source/settlement-report/SettlementReports.Infrastructure/Experimental/DatabricksSqlQueryExecutor.cs b/source/settlement-report/SettlementReports.Infrastructure/Experimental/DatabricksSqlQueryExecutor.cs index 11263ba..740480e 100644 --- a/source/settlement-report/SettlementReports.Infrastructure/Experimental/DatabricksSqlQueryExecutor.cs +++ b/source/settlement-report/SettlementReports.Infrastructure/Experimental/DatabricksSqlQueryExecutor.cs @@ -63,7 +63,7 @@ internal string BuildDebugString(DatabricksSqlQueryable query) private IAsyncEnumerable ExecuteCoreAsync(DatabricksStatement databricksStatement, CancellationToken cancellationToken = default) { - var rows = _databricksSqlWarehouseQueryExecutor.ExecuteStatementAsync(databricksStatement, QueryOptions.WithFormat(Format.JsonArray).WithParallelDownload(), cancellationToken); + var rows = _databricksSqlWarehouseQueryExecutor.ExecuteStatementAsync(databricksStatement, QueryOptions.WithFormat(Format.JsonArray), cancellationToken); return _sqlRowHydrator.HydrateAsync(rows, cancellationToken); } diff --git a/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountFileGenerator.cs b/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountFileGenerator.cs index ce96f66..56b7854 100644 --- a/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountFileGenerator.cs +++ b/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountFileGenerator.cs @@ -75,7 +75,10 @@ public SettlementReportMonthlyAmountRowMap() Resolution.Hour => "PT1H", Resolution.Day => "P1D", Resolution.Month => "P1M", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.Resolution)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.Resolution), + row.Value.Resolution, + "Value does not contain a enum representation of a Resolution"), }); Map(r => r.QuantityUnit) @@ -86,7 +89,10 @@ public SettlementReportMonthlyAmountRowMap() null => string.Empty, QuantityUnit.Kwh => "KWH", QuantityUnit.Pieces => "PCS", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.QuantityUnit)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.QuantityUnit), + row.Value.QuantityUnit, + string.Empty), }); Map(r => r.Currency) @@ -95,7 +101,10 @@ public SettlementReportMonthlyAmountRowMap() .Convert(row => row.Value.Currency switch { Currency.DKK => "DKK", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.Currency)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.Currency), + row.Value.Currency, + "Value does not contain a enum representation of a Currency"), }); Map(r => r.Amount) @@ -112,7 +121,10 @@ public SettlementReportMonthlyAmountRowMap() ChargeType.Tariff => "D03", ChargeType.Fee => "D02", ChargeType.Subscription => "D01", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.ChargeType)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.ChargeType), + row.Value.ChargeType, + "Value does not contain a enum representation of a ChargeType"), }); Map(r => r.ChargeCode) diff --git a/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountTotalFileGenerator.cs b/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountTotalFileGenerator.cs index a2b68cf..404309e 100644 --- a/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountTotalFileGenerator.cs +++ b/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountTotalFileGenerator.cs @@ -81,7 +81,10 @@ public SettlementReportTotalMonthlyAmountRowMap(SettlementReportRequestedByActor Resolution.Hour => "PT1H", Resolution.Day => "P1D", Resolution.Month => "P1M", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.Resolution)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.Resolution), + row.Value.Resolution, + "Value does not contain a enum representation of a Resolution."), }); Map(r => r.QuantityUnit) @@ -89,9 +92,13 @@ public SettlementReportTotalMonthlyAmountRowMap(SettlementReportRequestedByActor .Index(6) .Convert(row => row.Value.QuantityUnit switch { + null => string.Empty, QuantityUnit.Kwh => "KWH", QuantityUnit.Pieces => "PCS", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.QuantityUnit)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.QuantityUnit), + row.Value.QuantityUnit, + "Value does not contain a enum representation of a quantity unit."), }); Map(r => r.Currency) @@ -100,7 +107,10 @@ public SettlementReportTotalMonthlyAmountRowMap(SettlementReportRequestedByActor .Convert(row => row.Value.Currency switch { Currency.DKK => "DKK", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.Currency)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.Currency), + row.Value.Currency, + "Value does not contain a enum representation of a Currency"), }); Map(r => r.Amount) @@ -117,7 +127,10 @@ public SettlementReportTotalMonthlyAmountRowMap(SettlementReportRequestedByActor ChargeType.Tariff => "D03", ChargeType.Fee => "D02", ChargeType.Subscription => "D01", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.ChargeType)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.ChargeType), + row.Value.ChargeType, + "Value does not contain a enum representation of a ChargeType."), }); Map(r => r.ChargeCode)