Inizio pagina stats licenze
This commit is contained in:
@@ -1468,6 +1468,82 @@ namespace LiMan.DB.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcola statistiche install per il periodo indicato
|
||||
/// </summary>
|
||||
/// <param name="dtStart"></param>
|
||||
/// <param name="dtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public InstallStatusDTO InstallStatusGetInfo(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
InstallStatusDTO answ = new InstallStatusDTO();
|
||||
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
|
||||
{
|
||||
// conteggio preliminare licenze impiegate
|
||||
var countSubLic = localDbCtx
|
||||
.DbSetSubLicenze
|
||||
.GroupBy(x => x.IdxLic)
|
||||
.Select(g => new
|
||||
{
|
||||
IdxLic = g.Key,
|
||||
NumLic = g.Count()
|
||||
});
|
||||
|
||||
// raccolgo in primis info riguardo updater...
|
||||
answ.UpdaterList = localDbCtx
|
||||
.DbSetLicenze
|
||||
.Where(x => x.CodApp == "UpdateManager")
|
||||
.Select(x => new ApplicativoDTO()
|
||||
{
|
||||
IdxLic = x.IdxLic,
|
||||
Chiave = x.Chiave,
|
||||
CodApp = x.CodApp,
|
||||
CodInst = x.CodInst,
|
||||
Descrizione = x.Descrizione,
|
||||
Tipo = x.Tipo,
|
||||
Scadenza = x.Scadenza,
|
||||
NumLicenze = x.NumLicenze,
|
||||
NumLicenzeAttive = countSubLic.Where(s => s.IdxLic == x.IdxLic).Select(c => c.NumLic).FirstOrDefault(),
|
||||
DataEnigma = x.DataEnigma,
|
||||
Enigma = x.Enigma,
|
||||
Payload = x.Payload
|
||||
})
|
||||
.ToList();
|
||||
|
||||
// recupero info x calcolare num chiamate nel periodo indicato...
|
||||
var rawCallList = localDbCtx
|
||||
.DbSetLogCall
|
||||
.Where(x => x.DataRif >= dtStart && x.DataRif < dtEnd && x.TargetUrl.Contains("api/release"))
|
||||
.ToList();
|
||||
|
||||
// eseguo conteggio x applicazione...
|
||||
var countAppCall = rawCallList
|
||||
.GroupBy(x => x.CodApp)
|
||||
.OrderByDescending(x => x.Count())
|
||||
.ToDictionary(g => g.Key, g => g.Count());
|
||||
answ.ReqCountApp = countAppCall;
|
||||
|
||||
// ora conteggio per ORA chiamata...
|
||||
var countHour = rawCallList
|
||||
.GroupBy(x => x.DataRif.Date.AddHours(x.DataRif.Hour))
|
||||
.ToDictionary(g => g.Key, g => g.Count());
|
||||
|
||||
answ.ReqCountHour = countHour;
|
||||
|
||||
// ora conteggio per GIORNO chiamata...
|
||||
var countDay = rawCallList
|
||||
.GroupBy(x => x.DataRif.Date)
|
||||
.ToDictionary(g => g.Key, g => g.Count());
|
||||
|
||||
answ.ReqCountDay= countDay;
|
||||
|
||||
// ora passo a valorizzare i numeri relativi ad app e versioni...
|
||||
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua refresh del payload della licenza dato info + enigma generato dal client
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user