mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 23:39:51 +01:00
CP-36392: Avoid multiple enumerations in LicenseStatus.cs
Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
This commit is contained in:
parent
3e861411db
commit
f2fdf31a5a
@ -207,13 +207,13 @@ namespace XenAdmin.Dialogs
|
||||
if (freeCount == 0 || freeCount < xenObject.Connection.Cache.Hosts.Length)
|
||||
return false;
|
||||
|
||||
var expiryGroups = from Host h in xenObject.Connection.Cache.Hosts
|
||||
var expiryGroups = (from Host h in xenObject.Connection.Cache.Hosts
|
||||
let exp = h.LicenseExpiryUTC()
|
||||
group h by exp
|
||||
into g
|
||||
select new { ExpiryDate = g.Key, Hosts = g };
|
||||
select new { ExpiryDate = g.Key, Hosts = g }).ToList();
|
||||
|
||||
if (expiryGroups.Count() > 1)
|
||||
if (expiryGroups.Count > 1)
|
||||
{
|
||||
expiryGroups = expiryGroups.OrderBy(g => g.ExpiryDate).ToList();
|
||||
if ((expiryGroups.ElementAt(1).ExpiryDate - expiryGroups.ElementAt(0).ExpiryDate).TotalDays > 30)
|
||||
|
Loading…
Reference in New Issue
Block a user