mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Move commands chart to ChartJS.
This commit is contained in:
@@ -44,6 +44,7 @@ using DiscImageChef.Server.Models;
|
||||
using Highsoft.Web.Mvc.Charts;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using OperatingSystem = DiscImageChef.Server.Models.OperatingSystem;
|
||||
using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID;
|
||||
using Version = DiscImageChef.Server.Models.Version;
|
||||
@@ -565,5 +566,23 @@ namespace DiscImageChef.Server.Controllers
|
||||
|
||||
return Json(result);
|
||||
}
|
||||
|
||||
public IActionResult GetCommandsData()
|
||||
{
|
||||
string[][] result =
|
||||
{
|
||||
ctx.Commands.OrderByDescending(o => o.Count).Take(10).Select(v => v.Name).ToArray(),
|
||||
ctx.Commands.OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
|
||||
};
|
||||
|
||||
if(result[0].Length < 10)
|
||||
return Json(result);
|
||||
|
||||
result[0][9] = "Other";
|
||||
|
||||
result[1][9] = (ctx.Commands.Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).ToString();
|
||||
|
||||
return Json(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user