Add service request categories to ticket overview API
This commit is contained in:
@@ -117,7 +117,7 @@ namespace C4IT.F4SD
|
|||||||
var source = !useRoleScope && IsUnassignedOverviewKey(key)
|
var source = !useRoleScope && IsUnassignedOverviewKey(key)
|
||||||
? unassignedEntries ?? new List<TicketOverviewEntry>()
|
? unassignedEntries ?? new List<TicketOverviewEntry>()
|
||||||
: entries;
|
: entries;
|
||||||
counts[key] = source.Count(entry => MatchesTicketOverviewKey(entry, key));
|
counts[key] = CountTicketOverviewEntries(source, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TicketOverviewCountsResult { Counts = counts };
|
return new TicketOverviewCountsResult { Counts = counts };
|
||||||
|
|||||||
@@ -309,8 +309,13 @@ namespace C4IT.F4SD
|
|||||||
"IncidentActive",
|
"IncidentActive",
|
||||||
"IncidentCritical",
|
"IncidentCritical",
|
||||||
"IncidentNewInfo",
|
"IncidentNewInfo",
|
||||||
|
"ServiceRequestsNew",
|
||||||
|
"ServiceRequestsActive",
|
||||||
|
"ServiceRequestsCritical",
|
||||||
|
"ServiceRequestsNewInfo",
|
||||||
"UnassignedTickets",
|
"UnassignedTickets",
|
||||||
"UnassignedTicketsCritical"
|
"UnassignedTicketsCritical",
|
||||||
|
"ServiceRequestsEnabled"
|
||||||
};
|
};
|
||||||
|
|
||||||
public class TicketOverviewCountsResult
|
public class TicketOverviewCountsResult
|
||||||
@@ -396,12 +401,11 @@ namespace C4IT.F4SD
|
|||||||
{
|
{
|
||||||
if (!useRoleScope && IsUnassignedOverviewKey(key))
|
if (!useRoleScope && IsUnassignedOverviewKey(key))
|
||||||
{
|
{
|
||||||
counts[key] = (unassignedEntries ?? new List<TicketOverviewEntry>())
|
counts[key] = CountTicketOverviewEntries(unassignedEntries, key);
|
||||||
.Count(entry => MatchesTicketOverviewKey(entry, key));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
counts[key] = entries.Count(entry => MatchesTicketOverviewKey(entry, key));
|
counts[key] = CountTicketOverviewEntries(entries, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,7 +462,7 @@ namespace C4IT.F4SD
|
|||||||
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
||||||
foreach (var key in normalizedKeys)
|
foreach (var key in normalizedKeys)
|
||||||
{
|
{
|
||||||
counts[key] = roleEntries.Count(entry => MatchesTicketOverviewKey(entry, key));
|
counts[key] = CountTicketOverviewEntries(roleEntries, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
countsByRole[roleId.ToString()] = counts;
|
countsByRole[roleId.ToString()] = counts;
|
||||||
@@ -934,7 +938,10 @@ namespace C4IT.F4SD
|
|||||||
if (entry == null || string.IsNullOrWhiteSpace(key))
|
if (entry == null || string.IsNullOrWhiteSpace(key))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var isTicket = !entry.IsIncident;
|
// TODO: Fachlich klaeren, ob Service Requests zusaetzlich unter "Tickets" aggregiert werden sollen.
|
||||||
|
var isTicket = string.Equals(entry.ActivityType, "SPSActivityTypeTicket", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| (!entry.IsIncident && string.IsNullOrWhiteSpace(entry.ActivityType));
|
||||||
|
var isServiceRequest = string.Equals(entry.ActivityType, "SPSActivityTypeServiceRequest", StringComparison.OrdinalIgnoreCase);
|
||||||
var hasPerson = entry.RecipientId != Guid.Empty;
|
var hasPerson = entry.RecipientId != Guid.Empty;
|
||||||
var hasRole = entry.RecipientRoleId != Guid.Empty;
|
var hasRole = entry.RecipientRoleId != Guid.Empty;
|
||||||
var isCritical = entry.ReactionTimeEscalated || entry.SolutionTimeEscalated;
|
var isCritical = entry.ReactionTimeEscalated || entry.SolutionTimeEscalated;
|
||||||
@@ -959,6 +966,14 @@ namespace C4IT.F4SD
|
|||||||
return entry.IsIncident && isCritical;
|
return entry.IsIncident && isCritical;
|
||||||
case "IncidentNewInfo":
|
case "IncidentNewInfo":
|
||||||
return entry.IsIncident && entry.NewInformationReceived;
|
return entry.IsIncident && entry.NewInformationReceived;
|
||||||
|
case "ServiceRequestsNew":
|
||||||
|
return isServiceRequest && (entry.State == 200 || entry.State == 201);
|
||||||
|
case "ServiceRequestsActive":
|
||||||
|
return isServiceRequest && isActive;
|
||||||
|
case "ServiceRequestsCritical":
|
||||||
|
return isServiceRequest && isCritical;
|
||||||
|
case "ServiceRequestsNewInfo":
|
||||||
|
return isServiceRequest && entry.NewInformationReceived;
|
||||||
case "UnassignedTickets":
|
case "UnassignedTickets":
|
||||||
return !hasPerson && hasRole && isNew;
|
return !hasPerson && hasRole && isNew;
|
||||||
case "UnassignedTicketsCritical":
|
case "UnassignedTicketsCritical":
|
||||||
@@ -968,6 +983,15 @@ namespace C4IT.F4SD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int CountTicketOverviewEntries(IEnumerable<TicketOverviewEntry> entries, string key)
|
||||||
|
{
|
||||||
|
if (string.Equals(key?.Trim(), "ServiceRequestsEnabled", StringComparison.OrdinalIgnoreCase))
|
||||||
|
return ticketAndServiceRequestEnabled() ? 1 : 0;
|
||||||
|
|
||||||
|
return (entries ?? Enumerable.Empty<TicketOverviewEntry>())
|
||||||
|
.Count(entry => MatchesTicketOverviewKey(entry, key));
|
||||||
|
}
|
||||||
|
|
||||||
private static bool GetBoolValue(object value)
|
private static bool GetBoolValue(object value)
|
||||||
{
|
{
|
||||||
if (value == null || value is DBNull)
|
if (value == null || value is DBNull)
|
||||||
|
|||||||
@@ -388,8 +388,13 @@ namespace C4IT.F4SD
|
|||||||
"IncidentActive",
|
"IncidentActive",
|
||||||
"IncidentCritical",
|
"IncidentCritical",
|
||||||
"IncidentNewInfo",
|
"IncidentNewInfo",
|
||||||
|
"ServiceRequestsNew",
|
||||||
|
"ServiceRequestsActive",
|
||||||
|
"ServiceRequestsCritical",
|
||||||
|
"ServiceRequestsNewInfo",
|
||||||
"UnassignedTickets",
|
"UnassignedTickets",
|
||||||
"UnassignedTicketsCritical"
|
"UnassignedTicketsCritical",
|
||||||
|
"ServiceRequestsEnabled"
|
||||||
};
|
};
|
||||||
|
|
||||||
public class cF4SDTicket : cF4SDTicketSummary
|
public class cF4SDTicket : cF4SDTicketSummary
|
||||||
@@ -532,12 +537,11 @@ namespace C4IT.F4SD
|
|||||||
{
|
{
|
||||||
if (!useRoleScope && IsUnassignedOverviewKey(key))
|
if (!useRoleScope && IsUnassignedOverviewKey(key))
|
||||||
{
|
{
|
||||||
counts[key] = (unassignedEntries ?? new List<TicketOverviewEntry>())
|
counts[key] = CountTicketOverviewEntries(unassignedEntries, key);
|
||||||
.Count(entry => MatchesTicketOverviewKey(entry, key));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
counts[key] = entries.Count(entry => MatchesTicketOverviewKey(entry, key));
|
counts[key] = CountTicketOverviewEntries(entries, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -589,12 +593,11 @@ namespace C4IT.F4SD
|
|||||||
{
|
{
|
||||||
if (!useRoleScope && IsUnassignedOverviewKey(key))
|
if (!useRoleScope && IsUnassignedOverviewKey(key))
|
||||||
{
|
{
|
||||||
counts[key] = (unassignedEntries ?? new List<TicketOverviewEntry>())
|
counts[key] = CountTicketOverviewEntries(unassignedEntries, key);
|
||||||
.Count(entry => MatchesTicketOverviewKey(entry, key));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
counts[key] = entries.Count(entry => MatchesTicketOverviewKey(entry, key));
|
counts[key] = CountTicketOverviewEntries(entries, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,7 +655,7 @@ namespace C4IT.F4SD
|
|||||||
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
||||||
foreach (var key in normalizedKeys)
|
foreach (var key in normalizedKeys)
|
||||||
{
|
{
|
||||||
counts[key] = roleEntries.Count(entry => MatchesTicketOverviewKey(entry, key));
|
counts[key] = CountTicketOverviewEntries(roleEntries, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
countsByRole[roleId.ToString()] = counts;
|
countsByRole[roleId.ToString()] = counts;
|
||||||
@@ -715,7 +718,7 @@ namespace C4IT.F4SD
|
|||||||
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
||||||
foreach (var key in normalizedKeys)
|
foreach (var key in normalizedKeys)
|
||||||
{
|
{
|
||||||
counts[key] = roleEntries.Count(entry => MatchesTicketOverviewKey(entry, key));
|
counts[key] = CountTicketOverviewEntries(roleEntries, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
countsByRole[roleId.ToString()] = counts;
|
countsByRole[roleId.ToString()] = counts;
|
||||||
@@ -1374,7 +1377,10 @@ namespace C4IT.F4SD
|
|||||||
if (entry == null || string.IsNullOrWhiteSpace(key))
|
if (entry == null || string.IsNullOrWhiteSpace(key))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var isTicket = !entry.IsIncident;
|
// TODO: Fachlich klaeren, ob Service Requests zusaetzlich unter "Tickets" aggregiert werden sollen.
|
||||||
|
var isTicket = string.Equals(entry.ActivityType, "SPSActivityTypeTicket", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| (!entry.IsIncident && string.IsNullOrWhiteSpace(entry.ActivityType));
|
||||||
|
var isServiceRequest = string.Equals(entry.ActivityType, "SPSActivityTypeServiceRequest", StringComparison.OrdinalIgnoreCase);
|
||||||
var hasPerson = entry.RecipientId != Guid.Empty;
|
var hasPerson = entry.RecipientId != Guid.Empty;
|
||||||
var hasRole = entry.RecipientRoleId != Guid.Empty;
|
var hasRole = entry.RecipientRoleId != Guid.Empty;
|
||||||
var isCritical = entry.ReactionTimeEscalated || entry.SolutionTimeEscalated;
|
var isCritical = entry.ReactionTimeEscalated || entry.SolutionTimeEscalated;
|
||||||
@@ -1399,6 +1405,14 @@ namespace C4IT.F4SD
|
|||||||
return entry.IsIncident && isCritical;
|
return entry.IsIncident && isCritical;
|
||||||
case "IncidentNewInfo":
|
case "IncidentNewInfo":
|
||||||
return entry.IsIncident && entry.NewInformationReceived;
|
return entry.IsIncident && entry.NewInformationReceived;
|
||||||
|
case "ServiceRequestsNew":
|
||||||
|
return isServiceRequest && (entry.State == 200 || entry.State == 201);
|
||||||
|
case "ServiceRequestsActive":
|
||||||
|
return isServiceRequest && isActive;
|
||||||
|
case "ServiceRequestsCritical":
|
||||||
|
return isServiceRequest && isCritical;
|
||||||
|
case "ServiceRequestsNewInfo":
|
||||||
|
return isServiceRequest && entry.NewInformationReceived;
|
||||||
case "UnassignedTickets":
|
case "UnassignedTickets":
|
||||||
return !hasPerson && hasRole && isNew;
|
return !hasPerson && hasRole && isNew;
|
||||||
case "UnassignedTicketsCritical":
|
case "UnassignedTicketsCritical":
|
||||||
@@ -1408,6 +1422,15 @@ namespace C4IT.F4SD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int CountTicketOverviewEntries(IEnumerable<TicketOverviewEntry> entries, string key)
|
||||||
|
{
|
||||||
|
if (string.Equals(key?.Trim(), "ServiceRequestsEnabled", StringComparison.OrdinalIgnoreCase))
|
||||||
|
return ticketAndServiceRequestEnabled() ? 1 : 0;
|
||||||
|
|
||||||
|
return (entries ?? Enumerable.Empty<TicketOverviewEntry>())
|
||||||
|
.Count(entry => MatchesTicketOverviewKey(entry, key));
|
||||||
|
}
|
||||||
|
|
||||||
private static bool GetBoolValue(object value)
|
private static bool GetBoolValue(object value)
|
||||||
{
|
{
|
||||||
if (value == null || value is DBNull)
|
if (value == null || value is DBNull)
|
||||||
|
|||||||
@@ -119,7 +119,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "overviewKeys",
|
"key": "overviewKeys",
|
||||||
"value": "TicketsNew,TicketsActive,TicketsCritical,TicketsNewInfo,IncidentNew,IncidentActive,IncidentCritical,IncidentNewInfo,UnassignedTickets,UnassignedTicketsCritical"
|
"value": "TicketsNew,TicketsActive,TicketsCritical,TicketsNewInfo,IncidentNew,IncidentActive,IncidentCritical,IncidentNewInfo,ServiceRequestsNew,ServiceRequestsActive,ServiceRequestsCritical,ServiceRequestsNewInfo,UnassignedTickets,UnassignedTicketsCritical,ServiceRequestsEnabled"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "queueOption",
|
"key": "queueOption",
|
||||||
|
|||||||
Reference in New Issue
Block a user