Browse Source

Merge branch 'master' of ssh://biuro.biall-net.pl:2222/p5/project-bocian

Piotr Labudda 7 năm trước cách đây
mục cha
commit
688c6274aa
1 tập tin đã thay đổi với 6 bổ sung4 xóa
  1. 6 4
      tools/Bocian.php

+ 6 - 4
tools/Bocian.php

@@ -1854,6 +1854,7 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 				// $json['summary']['step'] = 'initialize' - recache - skip
 				// $json['summary']['step'] = 'relations' - szuka powiązań (@see AVG(details.progress / summary.count))
 				// $json['summary']['step'] = 'reports' - generuje pliki (@see summary.created)
+				/*
 				if ($DBG_FAKE_ANIM && 82 == $id) { // TODO: DBG
 					$json = [
 						'summary' => [
@@ -1867,6 +1868,7 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 							'25' => [ 'progress' => 0, 'results' => 123, 'elapsed' => 45.286203145981, 'estimated' => 0 ],
 					] ];
 				}
+				*/
 				if ($DBG_FAKE_ANIM && 80 == $id) { // TODO: DBG
 					$json = [
 						'summary' => [
@@ -1906,10 +1908,10 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 					return floatval($detail['progress']);
 				}, $json['details']);
 
-				$relationsProgress = $json['summary']['count'] > 0 ? (array_sum($listDetailsProgress) / $json['summary']['count']) : 0;
-				$reportsCount = V::get('reportsCount', 0, $json['summary'], 'int');
-				$reportsProgress = $reportsCount > 0 ? (V::get('reportsCreated', 0, $json['summary'], 'float') / $reportsCount) : 0;
-				return round(0.5 * $relationsProgress + 0.5 * $reportsProgress, 2);
+				$relationsProgress = $json['summary']['count'] > 0 ? round(floatval(array_sum($listDetailsProgress)) / floatval($json['summary']['count']), 3) : 0;
+				$reportsCount = V::get('reportsCount', 0, $json['summary'], 'float');
+				$reportsProgress = $reportsCount > 0 ? round(V::get('reportsCreated', 0, $json['summary'], 'float') / $reportsCount, 3) : 0;
+				return round(0.5 * $relationsProgress + 0.5 * $reportsProgress, 3);
 			} catch (Exception $e) {
 				DBG::log($e);
 			}