[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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Logof_Client;
|
namespace Logof_Client;
|
||||||
|
|
||||||
@@ -7,20 +8,28 @@ public class AddressRepair(ProgressWindow progressWindow)
|
|||||||
{
|
{
|
||||||
private readonly ProgressWindow _progress = progressWindow;
|
private readonly ProgressWindow _progress = progressWindow;
|
||||||
|
|
||||||
public KasAddressList Perform(KasAddressList all_addresses,
|
public async Task Perform(KasAddressList list)
|
||||||
List<(int, List<AddressCheck.ErrorTypes>)> failed_addresses)
|
|
||||||
{
|
{
|
||||||
try
|
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)
|
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