Update plateform summary

This commit is contained in:
2025-08-14 18:59:37 +07:00
parent cfb04e9dc9
commit 345d76e06f
6 changed files with 272 additions and 25 deletions

View File

@@ -459,19 +459,11 @@ public class DataController : ControllerBase
/// <summary>
/// Retrieves a summary of platform activity across all agents (platform-level data only)
/// </summary>
/// <param name="timeFilter">Time filter to apply (24H, 3D, 1W, 1M, 1Y, Total)</param>
/// <returns>A summary of platform activity without individual agent details</returns>
[HttpGet("GetPlatformSummary")]
public async Task<ActionResult<PlatformSummaryViewModel>> GetPlatformSummary(string timeFilter = "Total")
public async Task<ActionResult<PlatformSummaryViewModel>> GetPlatformSummary()
{
// Validate time filter
var validTimeFilters = new[] { "24H", "3D", "1W", "1M", "1Y", "Total" };
if (!validTimeFilters.Contains(timeFilter))
{
timeFilter = "Total"; // Default to Total if invalid
}
string cacheKey = $"PlatformSummary_{timeFilter}";
const string cacheKey = "PlatformSummary";
// Check if the platform summary is already cached
var cachedSummary = _cacheService.GetValue<PlatformSummaryViewModel>(cacheKey);
@@ -481,15 +473,14 @@ public class DataController : ControllerBase
return Ok(cachedSummary);
}
// Get all agents and their strategies
var agentsWithStrategies = await _mediator.Send(new GetAllAgentsCommand(timeFilter));
// Get all agents and their strategies (without time filter)
var agentsWithStrategies = await _mediator.Send(new GetAllAgentsCommand());
// Create the platform summary
var summary = new PlatformSummaryViewModel
{
TotalAgents = agentsWithStrategies.Count,
TotalActiveStrategies = agentsWithStrategies.Values.Sum(list => list.Count),
TimeFilter = timeFilter
TotalActiveStrategies = agentsWithStrategies.Values.Sum(list => list.Count)
};
// Calculate total platform metrics