From d3ee926a458bf936a605ef1e2c482befb83c5a12 Mon Sep 17 00:00:00 2001 From: Elena.Budnik Date: Thu, 21 Mar 2019 13:19:59 +0100 Subject: [PATCH] users in dataset Stat --- php/classes/AmdaStats.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/php/classes/AmdaStats.php b/php/classes/AmdaStats.php index 5b114fd..f8ee7d2 100644 --- a/php/classes/AmdaStats.php +++ b/php/classes/AmdaStats.php @@ -74,7 +74,7 @@ class AmdaStats { $doc2 = new DomDocument("1.0"); if ($year == null) $year = date("Y"); - + $users=glob(USERPATH."*"); foreach ($users as $user) { $name2 = $user."/Stats$year.xml"; @@ -82,7 +82,7 @@ class AmdaStats { if (!file_exists($name2)) continue; $doc2->load($name2); - + foreach ($tags as $tag) { $tag1 = $this->statXml->getElementsByTagName($tag)->item(0); $tag2 = $doc2->getElementsByTagName($tag)->item(0); @@ -100,7 +100,7 @@ class AmdaStats { $this->getModulesStat(null,null,true); // write data statistics as json $this->getDataStat(0,null,null,true); - + return $this->statXml->save(StatsXml); } @@ -210,6 +210,7 @@ class AmdaStats { $TOTALarray = array(); $STARTarray = array(); $STOParray = array(); + $usersArray = array(); foreach ($this->tasks as $task) { $theTask = $this->statXml->getElementsByTagName($task)->item(0); @@ -219,10 +220,14 @@ class AmdaStats { foreach ($items as $item){ $VIs = $item->getElementsByTagName('dataset'); $time = strtotime($item->getAttribute('date')); - + $user = $item->getAttribute('user'); + foreach ($VIs as $VI) { $id = $VI->nodeValue; if ($id) { + + $usersArray[$id][$user]++; + if ($TASKarray[$id]) { $TASKarray[$id]++; $TOTALarray[$id]++; @@ -251,7 +256,7 @@ class AmdaStats { } $VIarray[$task] = $TASKarray; } - + $GENERALarray = array(); arsort($TOTALarray); @@ -264,12 +269,14 @@ class AmdaStats { $mining = $VIarray['mining'][$key]; $print = $VIarray['print'][$key]; $stat = $VIarray['statistics'][$key]; + $uniqueUsers = count($usersArray[$key]); + if ($key != 'undefined') { $GENERALarray[] = array('id' => $key, 'number' => $value, 'percent' => $value, 'plot' => $plot, 'mining' => $mining, 'print' => $print,'statistics' => $stat, - 'start' => $viStart, 'stop' => $viStop); + 'start' => $viStart, 'stop' => $viStop, 'unique' => $uniqueUsers); $Ntotal += $value; } -- libgit2 0.21.2