Changeset 9545 for branches/HiveStatistics/sources
- Timestamp:
- 05/28/13 09:56:11 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/HiveStatisticsGenerator.cs
r9541 r9545 2 2 using System.Linq; 3 3 using System.Transactions; 4 using HeuristicLab.Services.Access; 4 5 using HeuristicLab.Services.Hive.DataAccess; 5 6 6 7 namespace HeuristicLab.Services.Hive { 7 8 public class HiveStatisticsGenerator : IStatisticsGenerator { 9 10 private IUserManager userManager { get { return ServiceLocator.Instance.UserManager; } } 11 8 12 private static readonly TimeSpan SmallestTimeSpan = new TimeSpan(0, 5, 0); 9 13 … … 68 72 JobName = j.Name, 69 73 UserId = j.OwnerUserId, 70 UserName = ""74 UserName = userManager.GetUserById(j.OwnerUserId).UserName 71 75 }; 72 76 … … 84 88 select new DimUser { 85 89 UserId = u, 86 Name = ""90 Name = userManager.GetUserById(u).UserName 87 91 }; 88 92 … … 140 144 var lastFacts = 141 145 from cf in db.FactClientInfos 142 group cf by cf.ClientId 143 into grpFacts 144 select grpFacts.OrderByDescending(x => x.Time).First(); 146 join r in db.DimClients on cf.ClientId equals r.Id 147 group cf by r.ResourceId into grpFacts 148 select new { 149 ResourceId = grpFacts.Key, 150 Fact = grpFacts.OrderByDescending(x => x.Time).First(), 151 }; 145 152 146 153 var slaves = 147 154 from s in db.Resources.OfType<Slave>() 148 155 join c in db.DimClients on s.ResourceId equals c.ResourceId 149 join lcf in lastFacts on c. Id equals lcf.ClientId into joinCf156 join lcf in lastFacts on c.ResourceId equals lcf.ResourceId into joinCf 150 157 from cf in joinCf.DefaultIfEmpty() 158 where c.ExpirationTime == null 151 159 select new { 152 160 Slave = s, 153 161 Client = c, 154 LastFact = cf 162 LastFact = cf != null ? cf.Fact : null 155 163 }; 156 164
Note: See TracChangeset
for help on using the changeset viewer.