[chore:] multiple things

This commit is contained in:
2025-08-23 11:48:28 +02:00
parent 9f0cfd09c3
commit 028df0fe91
15 changed files with 116 additions and 51 deletions

View File

@@ -11,16 +11,20 @@ public class AddressCheck
{
PlzTooShort,
PlzTooLong,
// empty,
FullAddressTooLong,
DoubledRefsid,
MayBeSameAddress
}
public enum WarningTypes
{
NoCity,
NoStreet,
NoLastName,
NoFirstName,
// empty,
FullAddressTooLong,
NoStreetNumber,
DoubledRefsid,
MayBeSameAddress
NoStreetNumber
}
private readonly ProgressWindow _progress;
@@ -30,9 +34,9 @@ public class AddressCheck
_progress = progressWindow;
}
public async Task<List<(int, List<ErrorTypes>)>> Perform(KasAddressList addresses)
public async Task<List<(int, List<ErrorTypes>, List<WarningTypes>)>> Perform(KasAddressList addresses)
{
var failed_refsids = new List<(int, List<ErrorTypes>)>();
var failed_refsids = new List<(int, List<ErrorTypes>, List<WarningTypes>)>();
var total = addresses.KasPersons.Count;
var current = 0;
@@ -41,6 +45,7 @@ public class AddressCheck
foreach (var person in addresses.KasPersons)
{
var errors = new List<ErrorTypes>();
var warnings = new List<WarningTypes>();
var hasFaults = false;
var address_component_count = 2; // cause anrede and name are first
@@ -64,7 +69,7 @@ public class AddressCheck
if (string.IsNullOrWhiteSpace(person.ort))
{
hasFaults = true;
errors.Add(ErrorTypes.NoCity);
warnings.Add(WarningTypes.NoCity);
}
else
{
@@ -82,26 +87,26 @@ public class AddressCheck
if (intcount == 0)
{
hasFaults = true;
errors.Add(ErrorTypes.NoStreetNumber);
warnings.Add(WarningTypes.NoStreetNumber);
}
if (string.IsNullOrWhiteSpace(person.name))
{
hasFaults = true;
errors.Add(ErrorTypes.NoLastName);
warnings.Add(WarningTypes.NoLastName);
}
if (string.IsNullOrWhiteSpace(person.vorname))
{
hasFaults = true;
errors.Add(ErrorTypes.NoFirstName);
warnings.Add(WarningTypes.NoFirstName);
}
if (string.IsNullOrWhiteSpace(person.strasse))
{
hasFaults = true;
errors.Add(ErrorTypes.NoStreet);
warnings.Add(WarningTypes.NoStreet);
}
else
{
@@ -160,7 +165,7 @@ public class AddressCheck
if (hasFaults)
lock (failed_refsids)
{
failed_refsids.Add((person.refsid, errors));
failed_refsids.Add((person.refsid, errors, warnings));
}
// Fortschritt aktualisieren

View File

@@ -27,7 +27,6 @@ public class CombineAddresses
private async Task<KasAddressList> Merge(KasAddressList first, KasAddressList second, int num, int total)
{
KasAddressList result = new();
foreach (var sec in second.KasPersons)
{
var is_new = true;
@@ -68,7 +67,7 @@ public class CombineAddresses
}
}
if (is_new) result.KasPersons.Add(sec);
if (is_new) first.KasPersons.Add(sec);
var subperc = second.KasPersons.IndexOf(sec) / second.KasPersons.Count;
var percent = (num + (double)subperc) / total * 100;
await Dispatcher.UIThread.InvokeAsync(() =>
@@ -82,6 +81,6 @@ public class CombineAddresses
});
}
return result;
return first;
}
}

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
namespace Logof_Client;
@@ -121,14 +122,35 @@ public class KasPerson
public class KasPersonError
{
public KasPersonError((int, List<AddressCheck.ErrorTypes>) single_result)
public KasPersonError((int, List<AddressCheck.ErrorTypes>, List<AddressCheck.WarningTypes>) single_result)
{
refsid = single_result.Item1;
try
{
foreach (var err in single_result.Item2) errors += err + ", ";
errors = errors.Trim();
errors = errors.TrimEnd(',');
}
catch
{
}
try
{
if (single_result.Item3 != null)
{
foreach (var err in single_result.Item3) warnings += err + ", ";
warnings = warnings.Trim();
warnings = warnings.TrimEnd(',');
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
public int refsid { get; set; }
public string errors { get; set; }
public string errors { get; set; } = "";
public string warnings { get; set; } = "";
}

View File

@@ -5,7 +5,6 @@ using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
using Avalonia.Threading;
namespace Logof_Client;
@@ -172,13 +171,10 @@ public partial class MainWindow : Window
progressWindow.Close();
File.WriteAllText(Dispatcher.UIThread.Invoke(() => OpenSettingsSaveAsDialog()).Result,
File.WriteAllText(OpenSettingsSaveAsDialog().Result,
new CsvBuilder(
"refsid,anrede,titel,vorname,adel,name,namezus,anredzus,strasse,strasse2,plz,ort,land,pplz,postfach,name1,name2,name3,name4,name5,funktion,funktion2,abteilung,funktionad,lastupdate",
result).BuildKas());
//new ResultWindow(result).Show();
}
private async Task<string> OpenSettingsSaveAsDialog()

View File

@@ -8,16 +8,17 @@ namespace Logof_Client;
public partial class ResultWindow : Window
{
public List<CheckBox> errortypecheckboxes = new();
public List<(int, List<AddressCheck.ErrorTypes>)> ur_result;
public List<(int, List<AddressCheck.ErrorTypes>, List<AddressCheck.WarningTypes>)> ur_result;
public List<CheckBox> warningtypecheckboxes = new();
public ResultWindow(List<(int, List<AddressCheck.ErrorTypes>)> result)
public ResultWindow(List<(int, List<AddressCheck.ErrorTypes>, List<AddressCheck.WarningTypes>)> result)
{
InitializeComponent();
ur_result = result;
Load(result);
}
private void GenerateView(List<(int, List<AddressCheck.ErrorTypes>)> result)
private void GenerateView(List<(int, List<AddressCheck.ErrorTypes>, List<AddressCheck.WarningTypes>)> result)
{
var errors = new List<KasPersonError>();
foreach (var single_result in result) errors.Add(new KasPersonError(single_result));
@@ -25,15 +26,23 @@ public partial class ResultWindow : Window
DgResult.ItemsSource = errors;
}
private void Load(List<(int, List<AddressCheck.ErrorTypes>)> result)
private void Load(List<(int, List<AddressCheck.ErrorTypes>, List<AddressCheck.WarningTypes>)> result)
{
var knownErrors = new List<AddressCheck.ErrorTypes>();
var knownWarnings = new List<AddressCheck.WarningTypes>();
foreach (var single_result in result)
{
foreach (var errtyp in single_result.Item2)
if (!knownErrors.Contains(errtyp))
knownErrors.Add(errtyp);
foreach (var wartyp in single_result.Item3)
if (!knownWarnings.Contains(wartyp))
knownWarnings.Add(wartyp);
}
foreach (var errtype in knownErrors)
{
var cb = new CheckBox();
@@ -44,6 +53,16 @@ public partial class ResultWindow : Window
StpFilterOptions.Children.Add(cb);
}
foreach (var wartype in knownWarnings)
{
var cb = new CheckBox();
cb.IsChecked = true;
cb.Content = wartype.ToString();
cb.Click += (sender, e) => UpdateFilter();
warningtypecheckboxes.Add(cb);
StpFilterOptions.Children.Add(cb);
}
GenerateView(result);
}
@@ -53,18 +72,31 @@ public partial class ResultWindow : Window
private void UpdateFilter()
{
var temp_result = new List<(int, List<AddressCheck.ErrorTypes>)>();
var temp_result = new List<(int, List<AddressCheck.ErrorTypes>, List<AddressCheck.WarningTypes>)>();
var checked_types = new List<AddressCheck.ErrorTypes>();
var checked_types_war = new List<AddressCheck.WarningTypes>();
foreach (var cb in errortypecheckboxes)
if (cb.IsChecked == true)
checked_types.Add(
(AddressCheck.ErrorTypes)Enum.Parse(typeof(AddressCheck.ErrorTypes), cb.Content.ToString()));
foreach (var cb in warningtypecheckboxes)
if (cb.IsChecked == true)
checked_types_war.Add(
(AddressCheck.WarningTypes)Enum.Parse(typeof(AddressCheck.WarningTypes), cb.Content.ToString()));
foreach (var sres in ur_result)
{
foreach (var err in sres.Item2)
if (checked_types.Contains(err) && !temp_result.Contains(sres))
temp_result.Add(sres);
foreach (var war in sres.Item3)
if (checked_types_war.Contains(war) && !temp_result.Contains(sres))
temp_result.Add(sres);
}
var errors = new List<KasPersonError>();
foreach (var single_result in temp_result) errors.Add(new KasPersonError(single_result));

View File

@@ -1 +1 @@
982c4bab1be7433e0655bc9d9093ed492303bd16c33e9bf09c663ad2ef1afbaa
9d71302617c5994ca25ba86e9f6470b4429e0686166ec81d7a41e9ab31df1343

Binary file not shown.

View File

@@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Logof Client")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+79e454fa0798dd4d65d644597aab3c43cffc33dc")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9f0cfd09c3953603741230374c4b81fcd710fca0")]
[assembly: System.Reflection.AssemblyProductAttribute("Logof Client")]
[assembly: System.Reflection.AssemblyTitleAttribute("Logof Client")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Von der MSBuild WriteCodeFragment-Klasse generiert.
// Generated by the MSBuild WriteCodeFragment class.

View File

@@ -1 +1 @@
dba61fcf7b622589bad0203aa3dbe33fc04aea760881f5a8d0f36c1b5d8f2535
bb8aef8b9e51521c6cf017c0b4260a3bea949a2efa414dd34c1e3fb67e86ea5d

View File

@@ -20,7 +20,6 @@
"net9.0"
],
"sources": {
"/usr/lib64/dotnet/library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@@ -85,12 +84,18 @@
],
"assetTargetFallback": true,
"warn": true,
"downloadDependencies": [
{
"name": "Microsoft.AspNetCore.App.Ref",
"version": "[9.0.5, 9.0.5]"
}
],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/lib64/dotnet/sdk/9.0.106/PortableRuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/9.0.106/PortableRuntimeIdentifierGraph.json"
}
}
}

View File

@@ -1497,7 +1497,6 @@
"net9.0"
],
"sources": {
"/usr/lib64/dotnet/library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@@ -1562,12 +1561,18 @@
],
"assetTargetFallback": true,
"warn": true,
"downloadDependencies": [
{
"name": "Microsoft.AspNetCore.App.Ref",
"version": "[9.0.5, 9.0.5]"
}
],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/lib64/dotnet/sdk/9.0.106/PortableRuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/9.0.106/PortableRuntimeIdentifierGraph.json"
}
}
}

View File

@@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "iFRYA+o6oII=",
"dgSpecHash": "G2hn8BEXuGk=",
"success": true,
"projectFilePath": "/home/fierke/Nextcloud/Documents/source/repos/logofclient/Logof Client/Logof Client.csproj",
"expectedPackageFiles": [
@@ -33,7 +33,8 @@
"/home/fierke/.nuget/packages/skiasharp.nativeassets.webassembly/2.88.9/skiasharp.nativeassets.webassembly.2.88.9.nupkg.sha512",
"/home/fierke/.nuget/packages/skiasharp.nativeassets.win32/2.88.9/skiasharp.nativeassets.win32.2.88.9.nupkg.sha512",
"/home/fierke/.nuget/packages/system.io.pipelines/8.0.0/system.io.pipelines.8.0.0.nupkg.sha512",
"/home/fierke/.nuget/packages/tmds.dbus.protocol/0.21.2/tmds.dbus.protocol.0.21.2.nupkg.sha512"
"/home/fierke/.nuget/packages/tmds.dbus.protocol/0.21.2/tmds.dbus.protocol.0.21.2.nupkg.sha512",
"/home/fierke/.nuget/packages/microsoft.aspnetcore.app.ref/9.0.5/microsoft.aspnetcore.app.ref.9.0.5.nupkg.sha512"
],
"logs": []
}

View File

@@ -1 +1 @@
"restore":{"projectUniqueName":"/home/fierke/Nextcloud/Documents/source/repos/logofclient/Logof Client/Logof Client.csproj","projectName":"Logof Client","projectPath":"/home/fierke/Nextcloud/Documents/source/repos/logofclient/Logof Client/Logof Client.csproj","outputPath":"/home/fierke/Nextcloud/Documents/source/repos/logofclient/Logof Client/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net9.0"],"sources":{"/usr/lib64/dotnet/library-packs":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net9.0":{"targetAlias":"net9.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"},"SdkAnalysisLevel":"9.0.100"}"frameworks":{"net9.0":{"targetAlias":"net9.0","dependencies":{"Avalonia":{"target":"Package","version":"[11.3.2, )"},"Avalonia.Controls.DataGrid":{"target":"Package","version":"[11.3.2, )"},"Avalonia.Desktop":{"target":"Package","version":"[11.3.2, )"},"Avalonia.Diagnostics":{"target":"Package","version":"[11.3.2, )"},"Avalonia.Fonts.Inter":{"target":"Package","version":"[11.3.2, )"},"Avalonia.Themes.Fluent":{"target":"Package","version":"[11.3.2, )"},"Lucide.Avalonia":{"target":"Package","version":"[0.1.35, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/usr/lib64/dotnet/sdk/9.0.106/PortableRuntimeIdentifierGraph.json"}}
"restore":{"projectUniqueName":"/home/fierke/Nextcloud/Documents/source/repos/logofclient/Logof Client/Logof Client.csproj","projectName":"Logof Client","projectPath":"/home/fierke/Nextcloud/Documents/source/repos/logofclient/Logof Client/Logof Client.csproj","outputPath":"/home/fierke/Nextcloud/Documents/source/repos/logofclient/Logof Client/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net9.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net9.0":{"targetAlias":"net9.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"},"SdkAnalysisLevel":"9.0.100"}"frameworks":{"net9.0":{"targetAlias":"net9.0","dependencies":{"Avalonia":{"target":"Package","version":"[11.3.2, )"},"Avalonia.Controls.DataGrid":{"target":"Package","version":"[11.3.2, )"},"Avalonia.Desktop":{"target":"Package","version":"[11.3.2, )"},"Avalonia.Diagnostics":{"target":"Package","version":"[11.3.2, )"},"Avalonia.Fonts.Inter":{"target":"Package","version":"[11.3.2, )"},"Avalonia.Themes.Fluent":{"target":"Package","version":"[11.3.2, )"},"Lucide.Avalonia":{"target":"Package","version":"[0.1.35, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"downloadDependencies":[{"name":"Microsoft.AspNetCore.App.Ref","version":"[9.0.5, 9.0.5]"}],"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/usr/share/dotnet/sdk/9.0.106/PortableRuntimeIdentifierGraph.json"}}

View File

@@ -1 +1 @@
17520917705843408
17523228750000000

View File

@@ -1 +1 @@
17520918778041105
17559386360285797