[chore:] initial address repair (fixes german plzs if too short)
This commit is contained in:
+17
-8
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Logof_Client;
|
||||
|
||||
@@ -7,20 +8,28 @@ public class AddressRepair(ProgressWindow progressWindow)
|
||||
{
|
||||
private readonly ProgressWindow _progress = progressWindow;
|
||||
|
||||
public KasAddressList Perform(KasAddressList all_addresses,
|
||||
List<(int, List<AddressCheck.ErrorTypes>)> failed_addresses)
|
||||
public async Task Perform(KasAddressList list)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
foreach (var person in list.KasPersons)
|
||||
{
|
||||
|
||||
// German PLZ too short (e.g. Dresden)
|
||||
if (person.IsGermany() && person.plz.Length <= 4)
|
||||
{
|
||||
while (person.plz.Length <= 4)
|
||||
{
|
||||
person.plz = "0" + person.plz;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Log($"Error while performing address repair: {ex.Message}", Logger.LogType.Error);
|
||||
Logger.Log($"Error while performing address shortener: {ex.Message}", Logger.LogType.Error);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user