Commit 3920c265 authored by Claire Kuchly's avatar Claire Kuchly
Browse files

Fix bug calcul purgeable size. Issue #2

parent bc3d51ce
......@@ -214,12 +214,16 @@ class tx_nG6_db {
'nb_runs' =>0,
'nb_analyses' =>0);
}
if ($res_row['run_id'] != "") {
$by_project[$res_row['project_id']]['state'][$res_row['state']]['nb_run']+=1;
$by_project[$res_row['project_id']]['state'][$res_row['state']]['size_run']+=$res_row['storage_size']+$res_row['purged_size'];
$by_project[$res_row['project_id']]['state'][$res_row['state']]['run_ids'][]=$res_row['run_id'];
$by_project[$res_row['project_id']]['total_purgeable_size'] += $res_row['storage_size'];
}
if ($res_row['run_id'] != "") {
$by_project[$res_row['project_id']]['state'][$res_row['state']]['nb_run']+=1;
$key = 'storage_size';
if($res_row['state'] = "purged"){
$key = "purged_size";
}
$by_project[$res_row['project_id']]['state'][$res_row['state']]['size_run']+=$res_row[$key];
$by_project[$res_row['project_id']]['state'][$res_row['state']]['run_ids'][]=$res_row['run_id'];
$by_project[$res_row['project_id']]['total_purgeable_size'] += $res_row['storage_size'];
}
}
$res = tx_nG6_db::select_all_in_view("tx_nG6_view_project_run_analyze",$where,'10');
......@@ -239,13 +243,17 @@ class tx_nG6_db {
'nb_runs' =>0,
'nb_analyses' =>0);
}
if ($res_row['analyze_id'] != ""){
$by_project[$res_row['project_id']]['state'][$res_row['state']]['nb_analyze'] += 1;
$by_project[$res_row['project_id']]['state'][$res_row['state']]['size_analyze'] += $res_row['storage_size']+$res_row['purged_size'];
$by_project[$res_row['project_id']]['state'][$res_row['state']]['analysis_ids'][]=$res_row['analyze_id'];
$by_project[$res_row['project_id']]['total_purgeable_size'] += $res_row['storage_size'];
}
}
if ($res_row['analyze_id'] != ""){
$by_project[$res_row['project_id']]['state'][$res_row['state']]['nb_analyze'] += 1;
$key = 'storage_size';
if($res_row['state'] = "purged"){
$key = "purged_size";
}
$by_project[$res_row['project_id']]['state'][$res_row['state']]['size_analyze'] += $res_row[$key];
$by_project[$res_row['project_id']]['state'][$res_row['state']]['analysis_ids'][]=$res_row['analyze_id'];
$by_project[$res_row['project_id']]['total_purgeable_size'] += $res_row['storage_size'];
}
}
$res = tx_nG6_db::select_all_in_view("tx_nG6_view_project_analyze", $where);
......@@ -268,9 +276,14 @@ class tx_nG6_db {
if ($res_row['analyze_id'] != ""){
$by_project[$res_row['project_id']]['state'][$res_row['state']]['nb_analyze'] += 1;
$by_project[$res_row['project_id']]['state'][$res_row['state']]['size_analyze'] += $res_row['storage_size']+$res_row['purged_size'];
$key = 'storage_size';
if($res_row['state'] = "purged"){
$key = "purged_size";
}
$by_project[$res_row['project_id']]['state'][$res_row['state']]['size_analyze'] += $res_row[$key];
$by_project[$res_row['project_id']]['state'][$res_row['state']]['analysis_ids'][]=$res_row['analyze_id'];
$by_project[$res_row['project_id']]['total_purgeable_size'] += $res_row['storage_size'];
}
}
......
......@@ -357,7 +357,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div>
<p>
Following table contains runs and analysis which can be purged, please alert project managers with button "send mail" after selecting projects.</br>
Then the project will be available for extention or purge in tab "Purge demand management"
Then the project will be available for extention or purge in tab "Purge demand management" </br>
This table contains <b><span id="nb_purgeable_project"></span> </b> corresponding to <b><span id=global_purgeable_size"</span></b>.
</p>
</div>
......
......@@ -712,11 +712,15 @@ function refresh_project_obsolete(obsolete_project_datatable){
url: "index.php?eID=tx_nG6&type=refresh_purge_list&max_retention_date="+max_retention_date+"&filter_size="+filter_size+"&create_users="+create_users_string+"&without_lab="+without_laboratories+"&with_lab="+with_laboratories,
dataType: 'json',
success: function(val, status, xhr) {
var nb_purgeable_project=0,
global_purgeable_size=0;
oTable = obsolete_project_datatable;
oTable.clear();
$.each(val, function(key,values){
var checkbox = '<center><input id="chk_obsolete_'+key+'" type="checkbox" value="' + key + '"></center>' ;
global_purgeable_size+=values["total_purgeable_size"];
nb_purgeable_project+=1;
var checkbox = '<center><input id="chk_obsolete_'+key+'" type="checkbox" value="' + key + '"></center>' ;
var row=[checkbox, "<a href='index.php?id=3&tx_nG6_pi1[project_id]="+key+"'>"+values["project_name"]+"</a>", values["nb_runs"]];
if (values["state"].hasOwnProperty('stored') && values["state"]["stored"] != null && values["state"]["stored"]['nb_run'] != null) {
......@@ -754,6 +758,8 @@ function refresh_project_obsolete(obsolete_project_datatable){
oTable.row.add(row );
});
oTable.draw();
$('#nb_purgeable_project').text(nb_purgeable_project);
$('#global_purgeable_size').text(get_octet_string_representation(global_purgeable_size,2));
$('#obsolete_list').show();
$('#data_table_obsolete_wait').hide();
......
Markdown is supported
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