Skip to content

Commit

Permalink
Bugfix: miscalculated volume expired label
Browse files Browse the repository at this point in the history
Fixes miscalculation when to set volume expired label.
  • Loading branch information
fbergkemper committed Apr 20, 2016
1 parent b0ec81a commit d3a20e7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions public/js/dataTables.functions.js
Expand Up @@ -120,18 +120,22 @@ function formatExpiration(volstatus, lastwritten, volretention) {
var b = new Date(a[0]).getTime() / 1000;
var interval = (d - b) / (3600 * 24);
var retention = Math.round(volretention / 60 / 60 / 24);
var expiration = Math.round(retention - interval);
var expiration = (retention - interval).toFixed(2);
if(expiration <= 0) {
return '<span class="label label-danger">expired</span>';
}

if(expiration > 0) {
return '<span class="label label-warning">expires in ' + expiration + ' day(s)</span>';
if(expiration > 0 && expiration <= 1) {
return '<span class="label label-warning">expires in 1 day</span>';
}

if(expiration > 1) {
return '<span class="label label-warning">expires in ' + Math.ceil(expiration) + ' days</span>';
}
}
}
else {
return Math.round((volretention / 60 / 60 / 24)) + ' day(s)';
return Math.ceil((volretention / 60 / 60 / 24)) + ' day(s)';
}
}

Expand Down

0 comments on commit d3a20e7

Please sign in to comment.