This repository has been archived by the owner on Jun 30, 2021. It is now read-only.
/
user_stats.html
executable file
·464 lines (445 loc) · 21.4 KB
/
user_stats.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
{% extends "base.html" %}
{% set active_page = "stats" %}
{% set page_title = 'User Stats - Mining and account information for user ' + username %}
{% block body %}
<script>
$(document).ready(function() {
{# Initial graph generation #}
generate_graph('hour', '%H:%M %p', '{{ username }}' );
{# Generate user stats #}
setTimeout(function(){
var hashrate, last_10_shares, difficulty, user_shares, est_payout,
round_reward, shares_to_solve, donate, coin_rate,
n_multiplier, pplns_total_shares;
{# load serverside info into js #}
round_reward = {{ config['reward'] or 0 }};
user_shares = {{ round_shares or 0 }};
pplns_total_shares = {{ pplns_total_shares or 0}}
last_10_shares = {{ last_10_shares or 0 }};
hashrate = {{ last_10_hashrate }};
difficulty = {{ g.average_difficulty or 'Nan' }};
donate = {{ donation_perc or 0 }};
n_multiplier = {{ config['last_n'] or 2}}
{# Run calculation functions #}
shares_to_solve = {{ g.shares_to_solve }};
est_payout = round_payout(difficulty, user_shares, shares_to_solve, donate, round_reward, n_multiplier, pplns_total_shares);
coin_rate = daily_est(last_10_shares, shares_to_solve, donate, round_reward);
setInterval(set_content = function(){
$('.odometer.hashrate').text(numberWithCommas(Math.round(hashrate * 1000) / 1000));
$('.odometer.usershares').text(numberWithCommas(Math.round(user_shares)));
$('.odometer.estpayout').text(numberWithCommas(Math.round(est_payout * 1000) / 1000));
$('.odometer.coinrate').text(numberWithCommas(Math.round(coin_rate * 1000) / 1000));
},1000);
set_content();
},1000);
$('table.worker-table > tbody > tr.gpu').bind( "click", function() {
// row was clicked
var jqxhr = $.ajax($(this).attr('data-url') )
.always(function(data) {
$('pre#modal-json').html(data['output']);
$('#myModal').modal()
});
});
$('div.collapse-button').bind( "click", function() {
$(this).text(function(i,old){
return old=='[ - ]' ? '[ + ]' : '[ - ]';
});
});
});
</script>
<div class="container">
<div class="row page-header">
<h2 style="word-wrap:break-word;margin-bottom:2px;">User Stats - {{ username }} </h2>
<span style="padding-left:15px;">Currently donating {{ donation_perc }}%
<a style="color:gray;" href="/set_donation/{{ username }}"><i class="fa fa-edit" ></i></a>
</span><br>
<br>
<div class="col-sm-3">
<div class="panel panel-default">
<div class="panel-body text-center">
<small>PPLN Shares</small>
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="Total shares being counted towards your next payout"></i>
<br><h4><p><span class="odometer usershares">...</span></p></h4>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="panel panel-default">
<div class="panel-body text-center">
<small>Est. Round Payout</small>
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="Payout estimate based on PPLNS (Last updated {{ pplns_cached_time }}). This estimate will be very close to your actual payout."></i>
<br><h4><p><span class="odometer estpayout">...</span> {{ config['coin_symbol'] | safe }}</p></h4>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="panel panel-default">
<div class="panel-body text-center">
<small>Average Hashrate</small>
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="Your average hashrate over the last 10 minutes based on your accepted shares, NOT PPAgent."></i>
<br><h4><p><span class="odometer hashrate">...</span> MHashes/sec</p></h4>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="panel panel-default">
<div class="panel-body text-center">
<small>Est. {{ config['coin_name'] | safe }}/day</small>
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="An estimate based on your hashrate for the last ten minutes, constant mining at that hashrate, and 100% round luck. Your actual payout will fluctuate based on round luck!"></i>
<br><h4><p><span class="odometer coinrate">...</span> {{ config['coin_symbol'] | safe }}</p></h4>
</div>
</div>
</div>
</div>
<div class="row row-header">
<div class="col-lg-12">
<ul class="nav nav-tabs">
<li class="active tab"><a id="hour" data-target="hour" data-format="%M:%S">Hour</a></li>
<li class="tab"><a id="day" data-target="day" data-format="%H:%M %p">Day</a></li>
<li class="tab"><a id="month" data-target="month" data-format="%m/%d %H:%M">Month</a></li>
</ul>
<div id="chart" style="height:400px;">
<img src="{{ config['assets_address'] | safe }}/img/712.GIF" style="position:absolute;padding-top:150px;padding-left:400px;"><svg></svg>
</div>
</div>
</div>
<div class="row page-header">
<h2>Worker Status</h2>
<br>
{% for worker in workers %}
<div class="col-lg-10 col-lg-offset-1 col-md-12 col-sm-12 col-xs-12">
<div class="panel panel-default" style="background-color:#243749;">
<div class="panel-heading">
<h3>
<i class="fa fa-circle" style="color:{% if worker['online'] %}#5BCE00{% else %}#B12627{% endif %}"
data-toggle="tooltip" data-placement="right"
title="{% if worker['online'] %}Online{% else %}Offline{% endif %}"></i>
{% if worker['name'] %}{{ worker['name'] }}{% else %}[unnamed]{% endif %}
<small style="font-size:8pt;">{{ worker['server'].get('stratum', '') }}</small>
<span class="pull-right">
<small class="text-right" style="padding-left:10px;font-weight:300;">Hashrate:
{{ worker['last_10_hashrate'] | round(3) }} MH/sec
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="Average hashrate over the last ten minutes based on accepted shares, NOT PPAgent."></i></small>
<small class="text-right" style="padding-left:10px;font-weight:300;">Efficiency:
{% if worker['efficiency'] %}
{{ worker['efficiency'] | round(2) }}%
{% else %}
--
{% endif %}
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="Computed from accepted/total({{ worker['accepted'] }}/{{ ((worker['accepted'] + worker['rejected'])) }}) shares submitted in the last 24 hours"></i></small>
</span>
</h3>
<div class="clearfix"></div>
{# <h6 style="padding-left:25px;margin:0;"><small>Ping: 23ms</small></h6>#}
</div>
<div class="panel-body" style="padding:0px;">
<div class="table-responsive bs-component" style="position:relative;padding:9px;">
<div class="col-xs-6 text-center">
<h4>Accepted Shares: {{ '{:,}'.format(worker['accepted']) }}
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="Accepted shares over the last 24 hours"></i></h4>
</div>
<div class="col-xs-6 text-center">
<h4>Rejected Shares: {{ '{:,}'.format(worker['rejected']) }}
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="Rejected shares over the last 24 hours"></i></h4>
</div>
<div class="clearfix"></div>
</div>
{# if there are miner status loop through them #}
{% if worker['status'] %}
{% set stat = worker['status'] %}
<div class="table-responsive bs-component worker-table-wrapper">
<div class="worker-wrapper">
<b>{{ stat['type'] }} status</b>
{% if not worker['name'] %}
{# Show a warning about unnamed workers #}
<small style="font-size:14px;color:#ff0000;font-weight:400;">
Multiple unnamed workers will do wonky things!
</small>
{% endif %}
{% if worker['status_stale'] == True %}
{# if stale then show a warning #}
<small colspan="3" style="font-size:14px;color:#EEA236;"> <i>Updated {{ worker['status_time'] | time_ago }}</i></small>
<div class="btn btn-default btn-sm collapse-button" data-toggle="collapse" data-target="#worker-{{ worker['name'] }}">
[ + ]
</div>
{% else %}
{# Not stale - show last updated time #}
<small colspan="3" style=" font-size:14px;font-weight:300;">
<i>Updated {{ worker['status_time'] | time_ago }}</i>
</small>
<div class="btn btn-default btn-sm collapse-button"
data-toggle="collapse" data-target="#worker-{{ worker['name'] }}">
[ - ]
</div>
{% endif %}
</div>
{# Worker's miner stats #}
<div id="worker-{{ worker['name'] }}" class="collapse{% if worker['status_stale'] == False %} in{% endif %}">
<div class="table-responsive bs-component" style="position:relative;padding:9px;">
<div class="col-xs-4 text-center">
<h4>WU: {{ worker['wu'] | round(2) }}
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="Work Utility is calculated from accepted n1 shares/time mining. This results in a number that represents the effective contributions, rather than the raw hashrate."></i></h4>
</div>
<div class="col-xs-4 text-center">
<h4>KHash/sec: {{ '{:,}'.format((worker['total_hashrate']*1000)|int) }}
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="Summation of the reported average hashrates"></i>
</div>
<div class="col-xs-4 text-center">
<h4>
{% if worker['wue'] < 0.80 %}
<i class="fa fa-circle" style="color:red"></i>
{% elif (worker['wue'] < 0.87) and (worker['wue'] >= 0.80) %}
<i class="fa fa-circle" style="color:yellow"></i>
{% elif worker['wue'] >= 0.87 %}
<i class="fa fa-circle" style="color:green"></i>
{% endif %}
WUE: {{ (worker['wue']*100)| round(2)}}%
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="This value is calculated from the reported WU({{ worker['wu'] }}) / reported average hashrate({{ (worker['total_hashrate']*1000)|int }}). A value of 90%+ is ideal. To increase your WUE make sure your rig is not having hardware errors"></i></h4>
</div>
<div class="clearfix"></div>
</div>
<table class="table table-striped table-hover worker-table">
<thead>
<tr>
<th>GPU</th>
<th>KHash/sec</th>
<th>WUE</th>
<th>Accepted/Rejected(%)</th>
<th>HW Errors</th>
<th>Temperature</th>
<th>Fan Speed</th>
<th>Core/Memory Clock</th>
</tr>
</thead>
<tbody>
{% for gpu in stat['gpus'] %}
<tr class="gpu" data-url="/{{ username }}/{{ worker['name'] }}/details/{{ loop.index0 }}">
<th>{{ loop.index0 }}</th>
<th {% if (gpu.get('MHS av', 0)*1000) == 0 %}class="warning"{% endif %}>
{{ (gpu.get('MHS av', 0)*1000)|round|int }}
</th>
<th>
{% set accepted = gpu.get('Difficulty Accepted', 0) %}
{% if accepted != 0 and gpu.get('Device Elapsed', 0) !=0 %}
{% set WU = (accepted / gpu['Device Elapsed'])*60 %}
{% else %}
{% set WU = 0 %}
{% endif %}
{% if WU == 0 or (gpu.get('MHS av', 0.0001) == 0) %}
-/-
{% else %}
{{ ( (WU / (gpu.get('MHS av', 0.0001)*1000) ) * 100 ) | round(1) }}%
{% endif %}
</th>
<th>
{{ '{:,}'.format(accepted|int) }} / {{ '{:,}'.format(gpu.get('Difficulty Rejected', 0)|int) }}
{% if accepted != 0 %}
({{ (((accepted - gpu.get('Difficulty Rejected', 0)) / accepted)*100)|round(2) }}%)
{% else %}
(0)
{% endif %}
</th>
<th>{{ gpu.get('Hardware Errors', 0) }}</th>
<th {% if gpu.get('temp', 0) > 90 %}class="danger"{% endif %}>{{ gpu.get('temp', 0) }}</th>
<th>{{ gpu.get('Fan Percent', 0) }}%</th>
<th>{{ gpu.get('GPU Clock', 0) }}/{{ gpu.get('Memory Clock', 0) }}</th>
</tr>
{% endfor %}
<tr>
<th colspan="8" style="text-align:left;">
<small>Running PPAgent v{{ stat.get('v', '0.2') }}</small>
{% if worker['status_version'] < config['latest_ppagent'] %}
{# Notice about out of date ppagent #}
<a href="https://github.com/icook/ppagent#upgrade">
<small style="color:#FFD600;font-weight:400;">
Newer version available here
</small>
</a>
{% endif %}
</th>
</tr>
</tbody>
</table>
</div>
</div>
{% else %}
{# No recorded workers, suggest using PPAgent #}
<div class="worker-wrapper">
<small>
Setup <a href="http://www.github.com/icook/ppagent/">PPAgent</a> to start reporting cgminer stats directly
</small>
</div>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
<div class="row row-header">
<h2>Account<small class="text-muted">- Currently donating {{ donation_perc }}%
<a style="color:gray;" href="/set_donation/{{ username }}"><i class="fa fa-edit" ></i></a>
</small></h2>
<br>
<div class="col-sm-3">
<div class="panel panel-default">
<div class="panel-body text-center">
<small>Balance</small>
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="Current unpaid balance not including bonus payouts"></i>
<br><h4><p>{{ '{:8,}'.format(balance / 100000000) }} {{ config['coin_symbol'] | safe }}</p></h4>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="panel panel-default">
<div class="panel-body text-center">
<small>Unconfirmed balance</small>
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="Newly solved block earnings, rewards not yet confirmed. Doesn't including bonus payouts"></i>
<br><h4><p>{{ '{:8,}'.format(unconfirmed_balance / 100000000) }} {{ config['coin_symbol'] | safe }}</p></h4>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="panel panel-default">
<div class="panel-body text-center">
<small>Total earned</small>
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="Total ever earned by this address from mining. No bonus payments included."></i>
<br><h4><p>{{ '{:2,}'.format((total_earned / 100000000) | round(2)) }} {{ config['coin_symbol'] | safe }}</p></h4>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="panel panel-default">
<div class="panel-body text-center">
<small>Total paid</small>
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="Total paid out to this address from mining. Bonus payments are included in this amount.">
</i>
<br><h4><p>{{ '{:2,}'.format((total_paid / 100000000) | round(2)) }} {{ config['coin_symbol'] | safe }}</p></h4>
</div>
</div>
</div>
<div class="clearfix"></div>
{% if acct_items %}
<div class="col-lg-12">
<div class="bs-example table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Time</th>
<th>Shares Contributed</th>
<th>Mined</th>
<th>Donation %</th>
<th>Donation/Bonus</th>
<th>Total paid</th>
<th>Blockheight</th>
<th>TX id</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for obj in acct_items %}
{% if obj.__tablename__ == 'payout' %}
{% set payout = obj %}
{# Set some vars for easy table printing #}
{% if payout.perc < 0 %}
{% set type = 'bonus' %}
{% set maths = payout.perc_applied * -1 %}
{% set perc_applied = payout.perc_applied * -1 %}
{% elif payout.perc == 0 %}
{% set maths = payout.perc_applied %}
{% set type = '' %}
{% set perc_applied = 0.0 %}
{% else %}
{% set type = 'donation' %}
{% set maths = payout.perc_applied * -1 %}
{% set perc_applied = payout.perc_applied %}
{% endif %}
<tr>
<th>{{ payout.created_at | time_ago }}</th>
<th>{{ '{:,}'.format(payout.shares) }}</th>
<th>{{ '{:,}'.format(((payout.amount - maths) / 100000000) | round(2)) }}</th>
<th>{{ '{:,}'.format(payout.perc) }}%</th>
<th>{{ type }}{{ ' {:,}'.format((perc_applied / 100000000) | round(2)) }}</th>
<th>{{ '{:,}'.format((payout.amount / 100000000) | round(2)) }}</th>
<th>{{ '{:,}'.format(payout.block.height) }}</th>
<th>{% if payout.transaction_id %}
<a href="{{ config['transaction_link_prefix'] }}{{ payout.transaction_id }}" target="_blank">
{{ payout.transaction_id | truncate(15, True) }}
</a>
{% endif %}
</th>
<th>
{% if payout.transaction_id %}
{% if payout.transaction.confirmed == True %}
Confirmed
{% else %}
Unconfirmed
{% endif %}
{% else %}
-
{% endif %}</th>
</tr>
{% else %}
<tr>
<th>{{ obj.created_at | time_ago }}</th>
<th colspan="4"><span style="color:#2ca02c;">Bonus:</span> {{ obj.description }}</th>
<th colspan="2">{{ '{:,}'.format(obj.amount / 100000000 | round(2)) }}</th>
<th>{% if obj.transaction_id %}
<a href="{{ config['transaction_link_prefix'] }}{{ obj.transaction_id }}" target="_blank">
{{ obj.transaction_id | truncate(15, True) }}
</a>
{% endif %}
</th>
<th>
{% if obj.transaction_id %}
{% if obj.transaction.confirmed == True %}
Confirmed
{% else %}
Unconfirmed
{% endif %}
{% else %}
-
{% endif %}</th>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
{% else %}
<div class="text-center"><h3>No payouts for this user yet</h3></div>
{% endif %}
</div>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">GPU Details</h4>
</div>
<div class="modal-body">
<pre id="modal-json"></pre>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
{% endblock %}