Consume ticket overview capabilities separately

This commit is contained in:
Meik
2026-07-20 09:47:17 +02:00
parent 21e9b85be7
commit 1a3bef9eeb
9 changed files with 93 additions and 47 deletions

View File

@@ -24,7 +24,6 @@ namespace FasdDesktopUi.Basics.Services
{
#region Fields
private const string TicketAndServiceRequestsEnabledKey = "TicketAndServiceRequestsEnabled";
private const bool TicketAndServiceRequestsEnabledDefault = true;
private readonly ITicketOverviewCommunicationSource _communicationSource;
private static readonly string[] OverviewKeys = new[]
@@ -339,12 +338,11 @@ namespace FasdDesktopUi.Basics.Services
_isDemo = communication.IsDemo();
var requestedKeys = scope == TileScope.Personal
? OverviewKeys.Concat(new[] { TicketAndServiceRequestsEnabledKey }).ToArray()
: OverviewKeys;
var rawCounts = await communication.GetTicketOverviewCounts(requestedKeys, scope == TileScope.Role).ConfigureAwait(false);
var result = await communication.GetTicketOverviewCounts(OverviewKeys, scope == TileScope.Role).ConfigureAwait(false);
var rawCounts = result?.Counts;
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
var ticketAndServiceRequestsEnabled = TicketAndServiceRequestsEnabledDefault;
var ticketAndServiceRequestsEnabled =
result?.Capabilities?.TicketAndServiceRequestsEnabled ?? TicketAndServiceRequestsEnabledDefault;
if (rawCounts != null)
{
@@ -353,13 +351,6 @@ namespace FasdDesktopUi.Basics.Services
if (string.IsNullOrWhiteSpace(kvp.Key))
continue;
if (string.Equals(kvp.Key, TicketAndServiceRequestsEnabledKey, StringComparison.OrdinalIgnoreCase))
{
if (scope == TileScope.Personal)
ticketAndServiceRequestsEnabled = _isDemo || kvp.Value > 0;
continue;
}
counts[kvp.Key] = Math.Max(0, kvp.Value);
}
}