Skip to content

Commit

Permalink
Fix NaN accepted percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
siunus committed Jul 27, 2023
1 parent d1306e4 commit 9bf52c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions v2023/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ setMiners = function (miners) {

let hashrates = 0,
accepted = 0,
rejected = 0;
rejected = 0,
percentage = 0;

let tableRows = "";
let num = 0;
Expand Down Expand Up @@ -341,7 +342,9 @@ setMiners = function (miners) {
</tr>`);
}

const percentage = (accepted / (accepted + rejected)) * 100;
if(miners.length > 0) {
percentage = (accepted / (accepted + rejected)) * 100;
}

activeMinersCount.text(miners.length);
acceptedPercentage.html(
Expand Down
2 changes: 1 addition & 1 deletion v2023/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ <h5 id="offcanvasNewsLabel" class="offcanvas-title">News</h5>
<script src="assets/js/main.js"></script>

<!-- Page JS -->
<script defer src="app.js?v=12"></script>
<script defer src="app.js?v=13"></script>
<script defer async src="siunusdev.counter.js?v=5"></script>

<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-app.js"></script>
Expand Down

0 comments on commit 9bf52c7

Please sign in to comment.