Skip to content

Commit

Permalink
Merge pull request #5283 from BOINC/dpa_submit10
Browse files Browse the repository at this point in the history
web: show batch output file size correctly
  • Loading branch information
davidpanderson authored Jun 22, 2023
2 parents c636206 + 998e991 commit d7f5aef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 1 addition & 3 deletions html/inc/submit_util.inc
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,7 @@ function batch_output_file_size($batchid) {
foreach ($names as $name) {
$path = dir_hier_path($name, $upload_dir, $fanout);
if (is_file($path)) {
$s=stat($path);
$size=$s['size'];
$batch_td_size+=$size;
$batch_td_size += filesize($path);
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions html/inc/util.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ function text_end() {
echo "</div>\n";
}

// express a size in terms of GB or MB
// express a size in terms of TB, GB etc.
//
function size_string($x) {
if ($x > TERA) {
Expand All @@ -1212,7 +1212,13 @@ function size_string($x) {
if ($x > GIGA) {
return number_format($x/GIGA, 2)." GB";
}
return number_format($x/MEGA, 2)." MB";
if ($x > MEGA) {
return number_format($x/MEGA, 2)." MB";
}
if ($x > KILO) {
return number_format($x/KILO, 2)." KB";
}
return "$x bytes";
}

function cert_filename() {
Expand Down

0 comments on commit d7f5aef

Please sign in to comment.