Remove get best agent
This commit is contained in:
@@ -90,45 +90,6 @@ public class AgentService : IAgentService
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<(IList<AgentBalanceHistory> Agents, int TotalCount)> GetBestAgents(
|
||||
DateTime start,
|
||||
DateTime? end = null,
|
||||
int page = 1,
|
||||
int pageSize = 10)
|
||||
{
|
||||
var effectiveEnd = end ?? DateTime.UtcNow;
|
||||
string cacheKey = $"BestAgents_{start:yyyyMMdd}_{effectiveEnd:yyyyMMdd}";
|
||||
|
||||
// Check if the results are already cached
|
||||
var cachedResult = _cacheService.GetValue<(IList<AgentBalanceHistory>, int)>(cacheKey);
|
||||
|
||||
if (cachedResult != default)
|
||||
{
|
||||
// Apply pagination to cached results
|
||||
var (cachedAgents, cachedTotalCount) = cachedResult;
|
||||
var paginatedAgents = cachedAgents
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
return (paginatedAgents, cachedTotalCount);
|
||||
}
|
||||
|
||||
// Get all agents with their balance history
|
||||
var (fetchedAgents, fetchedTotalCount) =
|
||||
await _agentBalanceRepository.GetAllAgentBalancesWithHistory(start, end);
|
||||
|
||||
// Cache all results for 5 minutes
|
||||
_cacheService.SaveValue(cacheKey, (fetchedAgents, fetchedTotalCount), TimeSpan.FromMinutes(5));
|
||||
|
||||
// Apply pagination
|
||||
var result = fetchedAgents
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
return (result, fetchedTotalCount);
|
||||
}
|
||||
|
||||
public async Task SaveOrUpdateAgentSummary(AgentSummary agentSummary)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user