Index: /trunk/sources/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.cs
===================================================================
--- /trunk/sources/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.cs	(revision 12924)
+++ /trunk/sources/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.cs	(revision 12925)
@@ -30,8 +30,4 @@
       throw new NotImplementedException();
     }
-
-    partial void OnCreated() {
-      LogFactory.GetLogger(this.GetType().Namespace).Log("HiveDataContext created");
-    }
   }
 }
Index: /trunk/sources/HeuristicLab.Services.Hive/3.3/HiveStatisticsGenerator.cs
===================================================================
--- /trunk/sources/HeuristicLab.Services.Hive/3.3/HiveStatisticsGenerator.cs	(revision 12924)
+++ /trunk/sources/HeuristicLab.Services.Hive/3.3/HiveStatisticsGenerator.cs	(revision 12925)
@@ -57,5 +57,5 @@
 
           pm.UseTransaction(() => {
-            UpdateTaskFactsTable(time, pm);
+            UpdateTaskFactsTable(pm);
             try {
               pm.SubmitChanges();
@@ -261,5 +261,5 @@
     }
 
-    private void UpdateTaskFactsTable(DimTime newTime, PersistenceManager pm) {
+    private void UpdateTaskFactsTable(PersistenceManager pm) {
       var factTaskDao = pm.FactTaskDao;
       var taskDao = pm.TaskDao;
@@ -273,27 +273,31 @@
 
       var newTasks =
-        from task in taskDao.GetAllChildTasks()
-        let stateLogs = task.StateLogs.OrderByDescending(x => x.DateTime)
-        let lastSlaveId = stateLogs.First(x => x.SlaveId != null).SlaveId
-        where (!factTaskIds.Contains(task.TaskId)
-               || notFinishedFactTasks.Select(x => x.TaskId).Contains(task.TaskId))
-        join lastFactTask in notFinishedFactTasks on task.TaskId equals lastFactTask.TaskId into lastFactPerTask
-        from lastFact in lastFactPerTask.DefaultIfEmpty()
-        join client in dimClientDao.GetActiveClients() on lastSlaveId equals client.ResourceId into clientsPerSlaveId
-        from client in clientsPerSlaveId.DefaultIfEmpty()
-        select new {
-          TaskId = task.TaskId,
-          JobId = task.JobId,
-          Priority = task.Priority,
-          CoresRequired = task.CoresNeeded,
-          MemoryRequired = task.MemoryNeeded,
-          State = task.State,
-          StateLogs = stateLogs.OrderBy(x => x.DateTime),
-          LastClientId = client != null
-                         ? client.Id : lastFact != null
-                         ? lastFact.LastClientId : (Guid?)null
-        };
+        (from task in taskDao.GetAllChildTasks()
+         let stateLogs = task.StateLogs.OrderByDescending(x => x.DateTime)
+         let lastSlaveId = stateLogs.First(x => x.SlaveId != null).SlaveId
+         where (!factTaskIds.Contains(task.TaskId)
+                || notFinishedFactTasks.Select(x => x.TaskId).Contains(task.TaskId))
+         join lastFactTask in notFinishedFactTasks on task.TaskId equals lastFactTask.TaskId into lastFactPerTask
+         from lastFact in lastFactPerTask.DefaultIfEmpty()
+         join client in dimClientDao.GetActiveClients() on lastSlaveId equals client.ResourceId into clientsPerSlaveId
+         from client in clientsPerSlaveId.DefaultIfEmpty()
+         select new {
+           TaskId = task.TaskId,
+           JobId = task.JobId,
+           Priority = task.Priority,
+           CoresRequired = task.CoresNeeded,
+           MemoryRequired = task.MemoryNeeded,
+           State = task.State,
+           StateLogs = stateLogs.OrderBy(x => x.DateTime),
+           LastClientId = client != null
+                          ? client.Id : lastFact != null
+                          ? lastFact.LastClientId : (Guid?)null,
+           NotFinishedTask = notFinishedFactTasks.Any(y => y.TaskId == task.TaskId)
+         }).ToList();
+
+      //insert facts for new tasks
       factTaskDao.Save(
-        from x in newTasks.ToList()
+        from x in newTasks
+        where !x.NotFinishedTask
         let taskData = CalculateFactTaskData(x.StateLogs)
         select new FactTask {
@@ -315,5 +319,28 @@
           InitialWaitingTime = taskData.InitialWaitingTime
         });
-      factTaskDao.Delete(notFinishedFactTasks.Select(x => x.TaskId));
+
+      //update data of already existing facts
+      foreach (var notFinishedTask in factTaskDao.GetNotFinishedTasks()) {
+        var ntc = newTasks.Where(x => x.TaskId == notFinishedTask.TaskId);
+        if (ntc.Any()) {
+          var x = ntc.Single();
+          var taskData = CalculateFactTaskData(x.StateLogs);
+
+          notFinishedTask.StartTime = taskData.StartTime;
+          notFinishedTask.EndTime = taskData.EndTime;
+          notFinishedTask.LastClientId = x.LastClientId;
+          notFinishedTask.Priority = x.Priority;
+          notFinishedTask.CoresRequired = x.CoresRequired;
+          notFinishedTask.MemoryRequired = x.MemoryRequired;
+          notFinishedTask.NumCalculationRuns = taskData.CalculationRuns;
+          notFinishedTask.NumRetries = taskData.Retries;
+          notFinishedTask.WaitingTime = taskData.WaitingTime;
+          notFinishedTask.CalculatingTime = taskData.CalculatingTime;
+          notFinishedTask.TransferTime = taskData.TransferTime;
+          notFinishedTask.TaskState = x.State;
+          notFinishedTask.Exception = taskData.Exception;
+          notFinishedTask.InitialWaitingTime = taskData.InitialWaitingTime;
+        }
+      }
     }
 
