Просмотр исходного кода

BiAuditGenerate - drobne poprawki (progress)

Mariusz Muszyński 8 лет назад
Родитель
Сommit
db7d12be60
1 измененных файлов с 6 добавлено и 4 удалено
  1. 6 4
      SE/se-lib/Route/UrlAction/BiAuditGenerate.php

+ 6 - 4
SE/se-lib/Route/UrlAction/BiAuditGenerate.php

@@ -2188,6 +2188,7 @@ class BiAuditPowiazania {
 	private $splittedResults = [];
 	private $maxResults = 1000000;
 	private $fidRow = [];
+	private $pracownikID = 0;
 
 	private static function generateJson($type, $data) {
 		return json_encode(['ts' => microtime(true), 'type' => $type, 'data' => $data]);
@@ -2217,10 +2218,10 @@ class BiAuditPowiazania {
 			$this->lastTimestamp = $timestamp;
 			$progressJson = self::generateJson('progress', ['progress' => $progress, 'item' => $this->i . "/" . $this->count, 'results' => count($this->results), 'step' => $this->step, 'elapsed' => $elapsed, 'estimated' => $estimated]);
 			echo $progressJson . "\n";
-			$this->progress[$this->i] = ['progress' => $progress, 'results' => (count($this->results) - $this->lastResults), 'elapsed' => $elapsed, 'estimated' => $estimated];
+			$this->progress['details'][$this->pracownikID] = ['progress' => $progress, 'results' => (count($this->results) - $this->lastResults), 'elapsed' => $elapsed, 'estimated' => $estimated];
 		}
-		if ($message !== null) $this->progress[0]['message'] = $message;
-		$this->progress[0]['ts'] = $timestamp;
+		if ($message !== null) $this->progress['summary']['message'] = $message;
+		$this->progress['summary']['ts'] = $timestamp;
 		file_put_contents($this->progressFile, json_encode($this->progress));
 	}
 
@@ -2270,12 +2271,13 @@ class BiAuditPowiazania {
 			on `all`.REMOTE_TABLE = 'BI_audit_ENERGA_PRACOWNICY' and `all`.REMOTE_ID = ref.REMOTE_PRIMARY_KEY and ref.PRIMARY_KEY = '{$this->ID}' order by `all`.`ID` asc";
 		$result = DB::getPDO()->fetchAll($query);
 		$this->count = count($result);
-		$this->progress[0]['count'] = $this->count;
+		$this->progress['summary']['count'] = $this->count;
 		$this->origMaxDepth = $this->maxDepth;
 
 		try {
 			foreach ($result as $i => $row) {
 				$this->i = $i + 1;
+				$this->pracownikID = $row['ID'];
 				$this->startTimestamp = microtime(true);
 				$this->lastProgress = 0;
 				$this->saveProgress(0, "Wyszukiwanie powiązań dla obiektu {$this->i}/{$this->count}");