Skip to content

Commit

Permalink
afanasy statistics: division by zero checks added
Browse files Browse the repository at this point in the history
  • Loading branch information
timurhai committed Apr 18, 2021
1 parent 9336310 commit 8d33eff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Binary file added afanasy/statistics/favicon.ico
Binary file not shown.
4 changes: 1 addition & 3 deletions afanasy/statistics/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
<head>
<meta charset="UTF-8">
<title>AFANASY Statistics</title>
<link rel="shortcut icon" href="../../favicon.ico" type="image/png">
<link type="text/css" rel="stylesheet" href="../../lib/styles.css">
<link rel="shortcut icon" href="favicon.ico" type="image/png">
<link type="text/css" rel="stylesheet" href="styles.css">
<script type="text/javascript" src="../../lib/js/cgru.js"></script>
<script type="text/javascript" src="general.js"></script>
</head>

Expand Down
12 changes: 8 additions & 4 deletions afanasy/statistics/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ function get_jobs_table( $i_args, &$o_out)
}
pg_free_result($sub_result);
$line['fav_name'] = $sub_name;
$line['fav_percent'] = $sub_favourite/$sub_total;
if ($sub_total > 0)
$line['fav_percent'] = $sub_favourite/$sub_total;

$o_out['table'][] = $line;
}
Expand Down Expand Up @@ -304,7 +305,8 @@ function get_tasks_folders( $i_args, &$o_out)
}
pg_free_result($sub_result);
$line['fav_service'] = $sub_name;
$line['fav_service_percent'] = $sub_favourite/$sub_total;
if ($sub_total > 0)
$line['fav_service_percent'] = $sub_favourite/$sub_total;

# Get folder favorite user:
$sub_query="
Expand All @@ -331,7 +333,8 @@ function get_tasks_folders( $i_args, &$o_out)
}
pg_free_result($sub_result);
$line['fav_user'] = $sub_name;
$line['fav_user_percent'] = $sub_favourite/$sub_total;
if ($sub_total > 0)
$line['fav_user_percent'] = $sub_favourite/$sub_total;

$o_out['table'][] = $line;
}
Expand Down Expand Up @@ -399,7 +402,8 @@ function get_tasks_table( $i_args, &$o_out)
}
pg_free_result($sub_result);
$line['fav_name'] = $sub_name;
$line['fav_percent'] = $sub_favourite/$sub_total;
if ($sub_total > 0)
$line['fav_percent'] = $sub_favourite/$sub_total;

$o_out['table'][] = $line;
}
Expand Down

0 comments on commit 8d33eff

Please sign in to comment.