Add logic to update or insert archive statistics in UploadStatsController

This commit is contained in:
2025-09-28 04:44:42 +01:00
parent fb1af1a57d
commit 46559687b3

View File

@@ -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) if(newstats.Filters != null)
{ {
foreach(NameValueStats nvs in newstats.Filters) foreach(NameValueStats nvs in newstats.Filters)