From 13456fed63d91eef631c1ffda4a5dfe45664b30c Mon Sep 17 00:00:00 2001 From: Ryan Prather Date: Sat, 13 Oct 2018 20:07:56 -0400 Subject: [PATCH] Update to fix #52. --- Database_Baseline.zip | Bin 1192868 -> 1193012 bytes inc/database.inc | 73 ++++++++++++++---------------------------- ste/stats.php | 1 - 3 files changed, 24 insertions(+), 50 deletions(-) diff --git a/Database_Baseline.zip b/Database_Baseline.zip index c7e0512a66aa3de90804639765f0d47a25fa9794..cf21074b30604b85126230bc1564f5a97ed23731 100644 GIT binary patch delta 3009 zcmV;y3qJIu=SZ~ZNPvU^gaU*Egam{Iga(8Mgb0KQgbIWUgbaiYgbsucgb;)gv=UYV ze>9R!O-(Nh$<+z~0FPS$02KfL0CQnyVPk1@d0%pGb#!TNWpgfbacu1zYmbva@UxfP zf7lNuZIfy|-|-b|%PCr^_TlRbAf+dfmI}0bG5&XFAFwarX!WY6CAll?&SQ6Hc6OLq zc9r-jaZg+?NKfw{9$dMCUY?F#_tA7Ue_x`bYgdnMAk+(zG!8zZTUYN~J-X9IvnWPy zgT?KesQK;gZTt4k7Dgn<&!Qx~hvuirm+)#Bd2Wc{>ba@=(M|k&IVS>pWvh#zj{JD- z#|ZwCAX;3)4ZD8rN*J9S9vmKwj4^sV==bdIv(B*79UDU%itKLRG_3K%$B&DOfA5!~ z4UN&HKORv$y<9>Z^!uH$Ik4c)vWzai1-znShGunM8Y8qyXLm(96U%%(F`ykr_XTDw zJ-3lueNDtX9t;ihsb#+~-g9)JFsC7x>4ZQ9?3aU{0qEIn8|8%!YhZUK{A4aNp;Kz0v&vs=n8e^;BaKVL?%8=sgL)-$3RuGTxb^@koTb&p_Uo#@k|utig%9_NTU&*j^a;ixlDOA$t7S z`{c&1m-?}t01mBWI7L-}!$jE~8lAC0IE(yHXM{#ZA5;Jx9-t%q=md+@e-5TjJ1>wP zFrN4rM`XIfbIRQWmIC{@M-g1c;|iLQsj}P#+XTf3$fBINwmWtq#&?^9UIcG(-g<|(Uea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h#}zfBL~+oI`=S@6K`(jpfh;5PzC+2o55C70r1BQ~ zPf@SQCoIAz7bZJ@kuOeE4&wcH?QM90rboLK!!+oww{y7;McHY_rXn-x?O5PZsX-iVrIF@0P@7<1uP#3g6DOd@<40 zj3`gYDa)y^)f<2e*zi*W6_b7ISX#dP`4e2aVt!AKuTHh6hYHL zfvoPTX9yaP4=g-bP(M6RIv_89jGpj#PzRs;=*P1~6r{oA1Kio~w^R)hkR%QXTSZI_ z?`0-M3IG5gQkU{E5;Yf}jpoFip3?yW$CylliPHfB$CylliPM)pG7>8T#0(ObaSaj{ zmx3}9P5}{@(J~T212Gd4m);W+8ka9K5-I~C8WNY!8WJ0qcQX~zpqcajj0*)z{ O=`#{V1}!ZT0002ExMJ4; diff --git a/inc/database.inc b/inc/database.inc index 790d5b7..95b225d 100644 --- a/inc/database.inc +++ b/inc/database.inc @@ -9850,65 +9850,40 @@ class db */ public function get_Cat_Count(ste_cat &$cat) { - $op = (empty($cat->get_ID()) ? IS : '='); - $value = ($op == IS ? null : $cat->get_ID()); - $this->help->select("get_pdi_count", ["SUM(`pdi_count`) AS 'total'"], [ - [ + $where = []; + if($cat->get_ID()) { + $where[] = [ 'field' => 'cat_id', - 'op' => $op, - 'value' => $value - ] - ]); - $rows = $this->help->execute(); - - if (is_array($rows) && isset($rows['total'])) { - $cat->total = $rows['total']; - $cat->nr = $rows['total']; + 'value' => $cat->get_ID() + ]; } else { - $cat->total = 0; + $where[] = [ + 'field' => 'ste_id', + 'value' => $cat->get_STE_ID() + ]; } + $this->help->select("target", ['cat_1', 'cat_2', 'cat_3', 'closed', 'not_applicable', 'not_reviewed'], $where); - $this->help->select("get_finding_count", ['status', "SUM(`finding_count`) AS 'finding_count'"], [ - [ - 'field' => 'cat_id', - 'op' => $op, - 'value' => $value - ] - ], [ - 'group' => 'status' - ]); $rows = $this->help->execute(); - - if (is_array($rows) && count($rows) && isset($rows['status'])) { - $rows = [0 => $rows]; + if(is_array($rows) && count($rows) && isset($rows['cat_1'])) { + $cat->open += $rows['cat_1'] + $rows['cat_2'] + $rows['cat_3']; + $cat->na += $rows['not_applicable']; + $cat->nf += $rows['closed']; + $cat->nr += $rows['not_reviewed']; } - - if (is_array($rows) && count($rows) && isset($rows[0])) { - foreach ($rows as $row) { - $cat->nr -= $row['finding_count']; - if ($row['status'] == 'Not Reviewed') { - $cat->nr += ($row['finding_count'] * 2); // to account for what was just subtracted - } - elseif ($row['status'] == 'Not a Finding' || $row['status'] == 'False Positive') { - $cat->nf += $row['finding_count']; - } - elseif ($row['status'] == 'Open' || $row['status'] == 'Exception') { - $cat->open += $row['finding_count']; - } - elseif ($row['status'] == 'Not Applicable') { - $cat->na += $row['finding_count']; - } + elseif(is_array($rows) && count($rows) && isset($rows[0])) { + foreach($rows as $r) { + $cat->open += $r['cat_1'] + $r['cat_2'] + $r['cat_3']; + $cat->na += $r['not_applicable']; + $cat->nf += $r['closed']; + $cat->nr += $r['not_reviewed']; } } - $this->help->select_count("target", [ - [ - 'field' => 'cat_id', - 'op' => $op, - 'value' => $value - ] - ]); + $cat->total = $cat->open + $cat->na + $cat->nf + $cat->nr; + + $this->help->select_count("target", $where); $cat->tgt_count = $this->help->execute(); } diff --git a/ste/stats.php b/ste/stats.php index f6e90c7..fbe6bb2 100644 --- a/ste/stats.php +++ b/ste/stats.php @@ -175,7 +175,6 @@ if ($ste_id) { } include_once "header.inc"; - ?>