From 3c83d69f7075a98868e1a9dbc242142b937c6e2c Mon Sep 17 00:00:00 2001 From: Francis Pion Date: Sun, 21 Apr 2024 14:52:05 -0400 Subject: [PATCH] Fixed ETL. --- .../Commands/ImportReceiptsCommandHandler.cs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/backend/tools/Faktur.ETL.Worker/Commands/ImportReceiptsCommandHandler.cs b/backend/tools/Faktur.ETL.Worker/Commands/ImportReceiptsCommandHandler.cs index 68c4cb5..2215a1e 100644 --- a/backend/tools/Faktur.ETL.Worker/Commands/ImportReceiptsCommandHandler.cs +++ b/backend/tools/Faktur.ETL.Worker/Commands/ImportReceiptsCommandHandler.cs @@ -23,8 +23,6 @@ public ImportReceiptsCommandHandler(IReceiptRepository receiptRepository, ITaxRe public async Task Handle(ImportReceiptsCommand command, CancellationToken cancellationToken) { - int errors = 0; - IEnumerable taxes = await _taxRepository.LoadAsync(cancellationToken); Dictionary receipts = (await _receiptRepository.LoadAsync(cancellationToken)) @@ -52,12 +50,6 @@ public async Task Handle(ImportReceiptsCommand command, CancellationToken c Dictionary itemCategories = new(capacity: receipt.Items.Count); foreach (ReceiptItem item in receipt.Items) { - if (item.Quantity < 1 || item.UnitPrice < 1 || item.Price < 1) - { - errors++; - continue; - } - NumberUnit? departmentNumber = null; DepartmentUnit? department = null; if (item.Department != null) @@ -68,13 +60,7 @@ public async Task Handle(ImportReceiptsCommand command, CancellationToken c items.Add(new ReceiptItemUnit(GtinUnit.TryCreate(item.Gtin), SkuUnit.TryCreate(item.Sku), new DisplayNameUnit(item.Label), FlagsUnit.TryCreate(item.Flags), item.Quantity, item.UnitPrice, item.Price, departmentNumber, department)); - - CategoryUnit? category = null; - if (item.Category != null && item.Category != "Shared") - { - category = new CategoryUnit(item.Category); - } - itemCategories[item.Number] = category; + itemCategories[item.Number] = CategoryUnit.TryCreate(item.Category); } ActorId createdBy = new(receipt.CreatedBy.Id);