Skip to content

Commit

Permalink
Fixed ETL.
Browse files Browse the repository at this point in the history
  • Loading branch information
Utar94 committed Apr 21, 2024
1 parent 2be9ecf commit 3c83d69
Showing 1 changed file with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ public ImportReceiptsCommandHandler(IReceiptRepository receiptRepository, ITaxRe

public async Task<int> Handle(ImportReceiptsCommand command, CancellationToken cancellationToken)
{
int errors = 0;

IEnumerable<TaxAggregate> taxes = await _taxRepository.LoadAsync(cancellationToken);

Dictionary<Guid, ReceiptAggregate> receipts = (await _receiptRepository.LoadAsync(cancellationToken))
Expand Down Expand Up @@ -52,12 +50,6 @@ public async Task<int> Handle(ImportReceiptsCommand command, CancellationToken c
Dictionary<ushort, CategoryUnit?> 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)
Expand All @@ -68,13 +60,7 @@ public async Task<int> 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);
Expand Down

0 comments on commit 3c83d69

Please sign in to comment.