Processing fixes

This commit is contained in:
Michał Zieliski
2024-06-05 12:18:20 +02:00
parent 4663a58c29
commit d8b0423a61
3 changed files with 27 additions and 13 deletions

View File

@@ -89,16 +89,18 @@ namespace WebAPI.dataProcessors
}
List<Record> allRecords = dataSources.SelectMany(x => x.Records!).ToList();
foreach (Record baseRecord in dataSources.Last()?.Records!)
List<string> baseCodess = allRecords.Select(x => x.Code!.Remove(0, 1)).Distinct().ToList();
foreach (string baseCode in baseCodess)
{
List<Record> codeRecords = allRecords.Where(x =>
x.Code!.Substring(1) == baseRecord.Code!.Substring(1))
x.Code!.Substring(1) == baseCode)
.ToList();
Record processedRecord = new Record
{
Id = Guid.NewGuid(),
Code = $"9{baseRecord.Code!.Remove(0,1)}",
Code = $"9{baseCode}",
CreatedAt = DateTime.UtcNow,
ModifiedAt = DateTime.UtcNow
};