Skip to content

Commit

Permalink
Display expired/missed tickets in /vsp table. (#1148)
Browse files Browse the repository at this point in the history
* Fix revoked % calculation.

* Replace revoked tickets with missed in /vsp table.

* Remove revoked ticket explaination.

* Rename Voting tickets to Live in /vsp table
  • Loading branch information
jholdstock authored Nov 7, 2023
1 parent b13fe93 commit af6dc1b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
25 changes: 11 additions & 14 deletions src/assets/js/vsp.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ var drawTable = function(data) {
'<tr class="">' +
'<th class="addressHeader" style="padding-left: 2px; background-image: none;">Address</th>' +
'<th class="lastUpdatedHeader">Last Updated</th>'+
'<th>Voting</th>' +
'<th>Live</th>' +
'<th>Voted</th>' +
'<th>Revoked</th>' +
'<th>Revoked %</th>' +
'<th>Missed</th>' +
'<th>Missed %</th>' +
'<th>Fees</th>' +
'<th>Age</th>' +
'</tr>' +
Expand All @@ -41,20 +41,17 @@ var drawTable = function(data) {

tableMarkup += '<td class="dcrwebcode">' + poolData["voting"] + '</td>';
tableMarkup += '<td class="dcrwebcode">' + poolData["voted"] + '</td>';
tableMarkup += '<td class="dcrwebcode">' + poolData["revoked"] + '</td>';
tableMarkup += '<td class="dcrwebcode">' + poolData["missed"] + '</td>';

var revokedPercent;
if (poolData["voted"] == 0) {
if (poolData["revoked"] == 0) {
revokedPercent = 0;
} else {
revokedPercent = 1;
}
var total = poolData["expired"] + poolData["missed"] + poolData["voted"];

var missedPercent;
if (total == 0) {
missedPercent = 0;
} else {
revokedPercent = 100 * (poolData["revoked"] / poolData["voted"]);
missedPercent = 100 * (poolData["missed"] / total);
}

tableMarkup += '<td class="dcrwebcode">' + revokedPercent.toFixed(2) + "%" + '</td>';
tableMarkup += '<td class="dcrwebcode">' + missedPercent.toFixed(2) + "%" + '</td>';

tableMarkup += '<td class="dcrwebcode">' + poolData["feepercentage"] + '%</td>';

Expand Down
2 changes: 1 addition & 1 deletion transifex_catalogs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"stakepools_description_3": "The following VSPs have been reviewed by the community.",
"notice": "Notice",
"warning": "Warning",
"stakepools_warning_1": "Tickets may be revoked either because they were missed, or because they expired. Missed tickets can be caused by a poorly connected Proof-of-Work (PoW) miner and may not necessarily be the fault of the provider.",
"stakepools_warning_1": "Missed tickets can be caused by a poorly connected Proof-of-Work (PoW) miner and may not necessarily be the fault of the provider.",
"stakepools_warning_2": "To encourage decentralization of the network, it is recommended to avoid providers that have over 5% of network votes.",
"news_title": "News",
"news_press_releases": "Press Releases",
Expand Down

0 comments on commit af6dc1b

Please sign in to comment.