|
@@ -1901,16 +1901,15 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
|
|
if (empty($json['summary']['count'])) return 0;
|
|
if (empty($json['summary']['count'])) return 0;
|
|
if (empty($json['summary']['step'])) return 0;
|
|
if (empty($json['summary']['step'])) return 0;
|
|
if (empty($json['details'])) return 0;
|
|
if (empty($json['details'])) return 0;
|
|
- if ('relations' === $json['summary']['step']
|
|
|
|
- || 'reports' === $json['summary']['step']
|
|
|
|
- ) {
|
|
|
|
- $listDetailsProgress = array_map(function ($detail) {
|
|
|
|
- return floatval($detail['progress']);
|
|
|
|
- }, $json['details']);
|
|
|
|
- return (array_sum($listDetailsProgress) + V::get('created', 0, $json['summary'], 'int')) / ($json['summary']['count'] * 2);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- return 0;
|
|
|
|
|
|
+ $listDetailsProgress = array_map(function ($detail) {
|
|
|
|
+ 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'], 'int') / $reportsCount) : 0;
|
|
|
|
+ return round(0.5 * $relationsProgress + 0.5 * $reportsProgress, 2);
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
DBG::log($e);
|
|
DBG::log($e);
|
|
}
|
|
}
|