Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/customer-portal/backend/modules/types/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,8 @@ public type ProjectSupportStats record {|
int? ongoingCases?;
# Active chats count
int activeChats?;
# Session chats count
int sessionChats?;
# Resolved past 30 days cases count
int resolvedPast30DaysChatsCount?;
Comment thread
Rashmika998 marked this conversation as resolved.
Resolved
# Resolved chats count
int resolvedChats?;
|};
Expand Down
7 changes: 3 additions & 4 deletions apps/customer-portal/backend/service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -966,13 +966,12 @@ service http:InterceptableService / on new http:Listener(9090, listenerConf) {
}
types:OverallConversationStats mappedConversationStats = getConversationStats(conversationStats);

int? ongoingCases = getOngoingCasesCount(caseStats);

return {
ongoingCases: ongoingCases is int ? ongoingCases : (),
ongoingCases: caseStats is entity:ProjectCaseStatsResponse ? caseStats.activeCount : (),
activeChats:
conversationStats is entity:ProjectConversationStatsResponse ? conversationStats.activeCount : (),
sessionChats: mappedConversationStats.sessionCount,
resolvedPast30DaysChatsCount:
caseStats is entity:ProjectCaseStatsResponse ? caseStats.resolvedCount.pastThirtyDays : (),
resolvedChats: mappedConversationStats.resolvedCount
};
}
Expand Down
23 changes: 0 additions & 23 deletions apps/customer-portal/backend/utils.bal
Original file line number Diff line number Diff line change
Expand Up @@ -637,29 +637,6 @@ public isolated function mapConversationResponse(entity:ConversationResponse res
};
}

# Get ongoing cases count from project case stats response.
#
# + response - Project case stats response from the entity service
# + return - Count of ongoing cases, or 0 if not available
public isolated function getOngoingCasesCount(entity:ProjectCaseStatsResponse|error response) returns int? {
if response is entity:ProjectCaseStatsResponse {
types:ReferenceItem[] stateCount = from entity:ChoiceListItem item in response.stateCount
where item.id.toString() != entity:caseStateIds.closed.toString()
&& item.id.toString() != entity:caseStateIds.solutionProposed.toString()
select {id: item.id.toString(), label: item.label, count: item.count};
if stateCount.length() > 0 {
int ongoingCasesCount = 0;
foreach types:ReferenceItem stat in stateCount {
int statCount = stat.count ?: 0;
ongoingCasesCount += statCount;
}
return ongoingCasesCount;
}
return 0;
}
return;
}

# Get conversation stats from project conversation stats response.
#
# + response - Project conversation stats response from the entity service
Expand Down