mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Use statistics for remote from DTO.
This commit is contained in:
Submodule DiscImageChef.CommonTypes updated: 16f61defb8...88268b5cc8
@@ -265,6 +265,53 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(newstats.RemoteApplications != null)
|
||||||
|
foreach(OsStats application in newstats.RemoteApplications)
|
||||||
|
{
|
||||||
|
RemoteApplication existing =
|
||||||
|
_ctx.RemoteApplications.FirstOrDefault(c => c.Name == application.name &&
|
||||||
|
c.Version == application.version);
|
||||||
|
|
||||||
|
if(existing == null)
|
||||||
|
_ctx.RemoteApplications.Add(new RemoteApplication
|
||||||
|
{
|
||||||
|
Name = application.name, Version = application.version, Count = application.Value
|
||||||
|
});
|
||||||
|
else
|
||||||
|
existing.Count += application.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(newstats.RemoteArchitectures != null)
|
||||||
|
foreach(NameValueStats nvs in newstats.RemoteArchitectures)
|
||||||
|
{
|
||||||
|
RemoteArchitecture existing = _ctx.RemoteArchitectures.FirstOrDefault(c => c.Name == nvs.name);
|
||||||
|
|
||||||
|
if(existing == null)
|
||||||
|
_ctx.RemoteArchitectures.Add(new RemoteArchitecture
|
||||||
|
{
|
||||||
|
Name = nvs.name, Count = nvs.Value
|
||||||
|
});
|
||||||
|
else
|
||||||
|
existing.Count += nvs.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(newstats.RemoteOperatingSystems != null)
|
||||||
|
foreach(OsStats remoteOperatingSystem in newstats.RemoteOperatingSystems)
|
||||||
|
{
|
||||||
|
RemoteOperatingSystem existing =
|
||||||
|
_ctx.RemoteOperatingSystems.FirstOrDefault(c => c.Name == remoteOperatingSystem.name &&
|
||||||
|
c.Version == remoteOperatingSystem.version);
|
||||||
|
|
||||||
|
if(existing == null)
|
||||||
|
_ctx.RemoteOperatingSystems.Add(new RemoteOperatingSystem
|
||||||
|
{
|
||||||
|
Name = remoteOperatingSystem.name, Version = remoteOperatingSystem.version,
|
||||||
|
Count = remoteOperatingSystem.Value
|
||||||
|
});
|
||||||
|
else
|
||||||
|
existing.Count += remoteOperatingSystem.Value;
|
||||||
|
}
|
||||||
|
|
||||||
_ctx.SaveChanges();
|
_ctx.SaveChanges();
|
||||||
|
|
||||||
response.Content = "ok";
|
response.Content = "ok";
|
||||||
|
|||||||
Reference in New Issue
Block a user