mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 03:04:26 +00:00
Add logic to update or insert archive statistics in UploadStatsController
This commit is contained in:
@@ -220,6 +220,25 @@ public sealed class UploadStatsController : ControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
if(newstats.Archives != null)
|
||||
{
|
||||
foreach(NameValueStats nvs in newstats.Archives)
|
||||
{
|
||||
Archive? existing = await _ctx.Archives.FirstOrDefaultAsync(c => c.Name == nvs.name);
|
||||
|
||||
if(existing == null)
|
||||
{
|
||||
_ctx.Archives.Add(new Archive
|
||||
{
|
||||
Name = nvs.name,
|
||||
Count = nvs.Value
|
||||
});
|
||||
}
|
||||
else
|
||||
existing.Count += nvs.Value;
|
||||
}
|
||||
}
|
||||
|
||||
if(newstats.Filters != null)
|
||||
{
|
||||
foreach(NameValueStats nvs in newstats.Filters)
|
||||
|
||||
Reference in New Issue
Block a user