|
|
@@ -3730,18 +3730,19 @@ class BiAuditPowiazania {
|
|
|
$this->saveToDb($path);
|
|
|
}
|
|
|
|
|
|
- private function weightCalc($n) {
|
|
|
- if (!$this->onlyTargets) return 1;
|
|
|
- if ($n < 21) return 1;
|
|
|
- if ($n < 41) return 2;
|
|
|
- if ($n < 81) return 3;
|
|
|
- if ($n < 161) return 4;
|
|
|
- if ($n < 321) return 5;
|
|
|
- if ($n < 641) return 6;
|
|
|
- if ($n < 1281) return 7;
|
|
|
- if ($n < 2561) return 8;
|
|
|
- if ($n < 5121) return 9;
|
|
|
- return 10;
|
|
|
+ private function weightCalc($c, $relationName) {
|
|
|
+ if (!$this->onlyTargets) return 0;
|
|
|
+ switch ($relationName) {
|
|
|
+ case 'BI_audit_KRS_address':
|
|
|
+ case 'BI_audit_MSIG_address':
|
|
|
+ case 'TERYT_adresy':
|
|
|
+ $w = 20;
|
|
|
+ return floor(log(((floor(($c - 1) / ($w / 2))) ?: 1), 2));
|
|
|
+ default:
|
|
|
+ return 0;
|
|
|
+// $w = 100;
|
|
|
+// return floor(log(((floor(($c - 1) / ($w / 2))) ?: 1), 2));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public function findPowiazania($ID, $weight = 0, $progress = 0, $steps = 1, $relation = "", $relationDateRange = "") {
|
|
|
@@ -3801,9 +3802,12 @@ class BiAuditPowiazania {
|
|
|
}));
|
|
|
|
|
|
$count = count($nodes);
|
|
|
- $weight += $this->weightCalc($count);
|
|
|
+ $weight++;
|
|
|
if ($weight <= $this->maxDepth) {
|
|
|
- foreach ($nodes as $i => $node) $this->findPowiazania($node['ID'], $weight, ($progress + ($i / ($count * $steps))), ($count * $steps), $node['RELATION_ID'], $node['PARAMS']);
|
|
|
+ foreach ($nodes as $i => $node) {
|
|
|
+ $weightNode = $weight + $this->weightCalc($count, $node['RELATION_ID']);
|
|
|
+ if ($weightNode <= $this->maxDepth) $this->findPowiazania($node['ID'], $weightNode, ($progress + ($i / ($count * $steps))), ($count * $steps), $node['RELATION_ID'], $node['PARAMS']);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
array_pop($this->path);
|