From f9194d3cbf492f96171c2ab8a7c797df2d952c40 Mon Sep 17 00:00:00 2001 From: Alex <77341673+defectiveAi@users.noreply.github.com> Date: Wed, 2 Oct 2024 13:15:13 +0200 Subject: [PATCH] No SYO on charge owner. --- .../MonthlyAmountTotalFileGenerator.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) 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 4642d9c..3e5b4a2 100644 --- a/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountTotalFileGenerator.cs +++ b/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountTotalFileGenerator.cs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +using CsvHelper; using CsvHelper.Configuration; using Energinet.DataHub.SettlementReport.Application.SettlementReports_v2; using Energinet.DataHub.SettlementReport.Common.Interfaces.Models; @@ -42,9 +43,14 @@ protected override IAsyncEnumerable GetAsync(S return _dataSource.GetAsync(filter, actorInfo, skipChunks, takeChunks); } - public sealed class SettlementReportMonthlyAmountRowMap : ClassMap + protected override void RegisterClassMap(CsvWriter csvHelper, SettlementReportRequestFilterDto filter, SettlementReportRequestedByActor actorInfo) { - public SettlementReportMonthlyAmountRowMap() + csvHelper.Context.RegisterClassMap(new SettlementReportTotalMonthlyAmountRowMap(actorInfo)); + } + + public sealed class SettlementReportTotalMonthlyAmountRowMap : ClassMap + { + public SettlementReportTotalMonthlyAmountRowMap(SettlementReportRequestedByActor actorInfo) { Map(r => r.EnergyBusinessProcess) .Name("ENERGYBUSINESSPROCESS") @@ -118,9 +124,12 @@ public SettlementReportMonthlyAmountRowMap() .Name("CHARGEID") .Index(10); - Map(r => r.ChargeOwnerId) - .Name("CHARGEOWNER") - .Index(11); + if (actorInfo.MarketRole is not MarketRole.SystemOperator) + { + Map(r => r.ChargeOwnerId) + .Name("CHARGEOWNER") + .Index(11); + } } } }