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

@@ -107,21 +107,21 @@ namespace WebAPI.dataProcessors
List<Record> allRecords = dataSources
.SelectMany(x => x.Records!).ToList();
List<Record> allRecordsValidation = 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();
List<Record> codeRecordsValidation = 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
};
@@ -138,7 +138,7 @@ namespace WebAPI.dataProcessors
ProcessHelper.getValue(processedRecord,i) !=
ProcessHelper.getValue(validationRecord, i))
{
throw new Exception($"ValidationError: Code {baseRecord.Code!}, " +
throw new Exception($"ValidationError: Code {baseCode!}, " +
$"Value{i} ({ProcessHelper.getValue(processedRecord, i)} | " +
$"{ProcessHelper.getValue(validationRecord, i)})");
}