Commit 086d87fb authored by Romain Therville's avatar Romain Therville 🐭
Browse files

fix for issue#27

Scripts and SQL requests have been updated to to count only "not hidden"
runs and analyzes in project view.
parent 1650618e
...@@ -196,7 +196,7 @@ class tx_nG6_db { ...@@ -196,7 +196,7 @@ class tx_nG6_db {
return (tx_nG6_db::select_list_retention_data_info($where)); return (tx_nG6_db::select_list_retention_data_info($where));
} }
static function select_a_project_retention_data_info($project_id=null, $all=FALSE) { static function select_a_project_retention_data_info($project_id=null, $all=FALSE, $count_hidden=FALSE) {
$condition=Array(); $condition=Array();
if ($all === FALSE) { if ($all === FALSE) {
$condition[]='DATEDIFF( FROM_UNIXTIME( retention_date ) , now( ) ) <0'; $condition[]='DATEDIFF( FROM_UNIXTIME( retention_date ) , now( ) ) <0';
...@@ -204,6 +204,9 @@ class tx_nG6_db { ...@@ -204,6 +204,9 @@ class tx_nG6_db {
if (null != $project_id) { if (null != $project_id) {
$condition[]="project_id = " . $project_id ; $condition[]="project_id = " . $project_id ;
} }
if(!$count_hidden){
$condition[]="hidden = 0";
}
$where = join( ' AND ', $condition); $where = join( ' AND ', $condition);
return(tx_nG6_db::select_list_retention_data_info($where)); return(tx_nG6_db::select_list_retention_data_info($where));
} }
...@@ -242,6 +245,7 @@ class tx_nG6_db { ...@@ -242,6 +245,7 @@ class tx_nG6_db {
$by_project[$current_project_id]['total_purgeable_size'] += $res_row['storage_size']; $by_project[$current_project_id]['total_purgeable_size'] += $res_row['storage_size'];
} }
} }
//select obsolete analyses of a run //select obsolete analyses of a run
$res = tx_nG6_db::select_all_in_view("tx_nG6_view_project_run_analyze",$where,'10'); $res = tx_nG6_db::select_all_in_view("tx_nG6_view_project_run_analyze",$where,'10');
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
...@@ -284,21 +288,21 @@ class tx_nG6_db { ...@@ -284,21 +288,21 @@ class tx_nG6_db {
} }
} }
$res = tx_nG6_db::select_count_in_view("tx_nG6_view_project_run",""); $res = tx_nG6_db::select_count_in_view("tx_nG6_view_project_run",$where);
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
if (isset ($by_project[$res_row['project_id']])) { if (isset ($by_project[$res_row['project_id']])) {
$by_project[$res_row['project_id']]["nb_runs"]=$res_row['count']; $by_project[$res_row['project_id']]["nb_runs"]=$res_row['count'];
} }
} }
$res = tx_nG6_db::select_count_in_view("tx_nG6_view_project_run_analyze",""); $res = tx_nG6_db::select_count_in_view("tx_nG6_view_project_run_analyze",$where);
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
if (isset ($by_project[$res_row['project_id']])) { if (isset ($by_project[$res_row['project_id']])) {
$by_project[$res_row['project_id']]["nb_analyses"]=$res_row['count']; $by_project[$res_row['project_id']]["nb_analyses"]=$res_row['count'];
} }
} }
$res = tx_nG6_db::select_count_in_view("tx_nG6_view_project_analyze",""); $res = tx_nG6_db::select_count_in_view("tx_nG6_view_project_analyze",$where);
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
if (isset ($by_project[$res_row['project_id']])) { if (isset ($by_project[$res_row['project_id']])) {
if (!isset ($by_project[$res_row['project_id']]["nb_analyses"])) { if (!isset ($by_project[$res_row['project_id']]["nb_analyses"])) {
......
...@@ -213,7 +213,13 @@ class tx_nG6_pi1 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { ...@@ -213,7 +213,13 @@ class tx_nG6_pi1 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
} }
$smarty->assign('h_analysis', tx_nG6_utils::trace_hierarchy($project_analysis)); $smarty->assign('h_analysis', tx_nG6_utils::trace_hierarchy($project_analysis));
$smarty->assign('project_analysis', $project_analysis); $smarty->assign('project_analysis', $project_analysis);
$smarty->assign('managment_purged_data', tx_nG6_db::select_a_project_retention_data_info($projects[key($projects)]['id'], TRUE));
if( $projects[$project_id]['is_admin'] == 1 ){
$smarty->assign('managment_purged_data', tx_nG6_db::select_a_project_retention_data_info($projects[key($projects)]['id'], TRUE, TRUE));
}else{
$smarty->assign('managment_purged_data', tx_nG6_db::select_a_project_retention_data_info($projects[key($projects)]['id'], TRUE, FALSE));
}
$txNG6Utils = new tx_nG6_utils; $txNG6Utils = new tx_nG6_utils;
//$smarty->register_object('tx_nG6_utils',$txNG6Utils); //$smarty->register_object('tx_nG6_utils',$txNG6Utils);
$smarty->assign_by_ref('tx_nG6_utils', $txNG6Utils); $smarty->assign_by_ref('tx_nG6_utils', $txNG6Utils);
......
...@@ -107,7 +107,7 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { ...@@ -107,7 +107,7 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
foreach(explode(",", $project_ids) as $project_id){ foreach(explode(",", $project_ids) as $project_id){
#retrieve project data #retrieve project data
$p=tx_nG6_db::select_a_project_retention_data_info($project_id); $p=tx_nG6_db::select_a_project_retention_data_info($project_id, FALSE, TRUE);
#build email list of managers #build email list of managers
$users_id=array(); $users_id=array();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment