Document AI role and HR exclusions

This commit is contained in:
2026-05-15 11:55:40 +02:00
parent 83e556e89e
commit 9daf54b8d9
6 changed files with 200 additions and 0 deletions
@@ -8,6 +8,15 @@ namespace TrafagSalesExporter.Services;
internal sealed class HrKpiDashboardBuilder
{
private readonly HrKpiDataSourceOptions _dataSources;
private static readonly HashSet<string> ExcludedPersonNameKeys = new(StringComparer.OrdinalIgnoreCase)
{
NormalizePersonExclusionKey("Angelina Jolie"),
NormalizePersonExclusionKey("Brad Pitt"),
NormalizePersonExclusionKey("Peter Muster"),
NormalizePersonExclusionKey("ICT Trafag"),
NormalizePersonExclusionKey("Empfanger Reminder"),
NormalizePersonExclusionKey("Empfänger Reminder")
};
public HrKpiDashboardBuilder(HrKpiDataSourceOptions dataSources)
{
@@ -40,6 +49,12 @@ internal sealed class HrKpiDashboardBuilder
var employees = LoadEmployees(context, timeRows, sapRows);
var absences = LoadAbsences(context);
var leavers = LoadLeavers(context);
var excludedRows =
employees.RemoveAll(x => IsExcludedTestPerson(x.NameVoll)) +
absences.RemoveAll(x => IsExcludedTestPerson(x.Name)) +
leavers.RemoveAll(x => IsExcludedTestPerson(x.NameVoll));
if (excludedRows > 0)
result.Notices.Add($"{excludedRows:N0} Testpersonen-Zeilen wurden aus dem HR-KPI-Dashboard ausgeschlossen.");
result.OrganisationOptions = employees
.Select(x => x.Organisationseinheit)
@@ -939,6 +954,18 @@ internal sealed class HrKpiDashboardBuilder
private static string NormalizeKey(string value)
=> value.Trim().ToUpperInvariant();
private static bool IsExcludedTestPerson(string? name)
=> !string.IsNullOrWhiteSpace(name) &&
ExcludedPersonNameKeys.Contains(NormalizePersonExclusionKey(name));
private static string NormalizePersonExclusionKey(string value)
{
var normalized = NormalizeReason(value)
.Replace(",", " ", StringComparison.OrdinalIgnoreCase);
var parts = normalized.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
return string.Join(" ", parts.OrderBy(x => x, StringComparer.OrdinalIgnoreCase));
}
private static int? ParseCostCenter(string value)
{
var raw = value.Split('/')[0].Trim();