diff --git a/DiscImageChef.CommonTypes b/DiscImageChef.CommonTypes index 16f61def..88268b5c 160000 --- a/DiscImageChef.CommonTypes +++ b/DiscImageChef.CommonTypes @@ -1 +1 @@ -Subproject commit 16f61defb8bb813be26e0412a75bc4ec4749d1de +Subproject commit 88268b5cc8cd42713fc808d0f454fa1b38f8adea diff --git a/DiscImageChef.Server/Controllers/UploadStatsController.cs b/DiscImageChef.Server/Controllers/UploadStatsController.cs index 90d90ff1..d945e13b 100644 --- a/DiscImageChef.Server/Controllers/UploadStatsController.cs +++ b/DiscImageChef.Server/Controllers/UploadStatsController.cs @@ -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(); response.Content = "ok";