Browse Source

earnPer

earnPer
master
yuriy0803 2 years ago
parent
commit
701d2f7ed5
  1. 51
      www/app/controllers/account/index.js
  2. 30
      www/app/templates/account/index.hbs

51
www/app/controllers/account/index.js

@ -18,9 +18,9 @@ export default Ember.Controller.extend({
marginRight: 10,
height: 290,
events: {
load: function() {
load: function () {
var series = this.series[0];
setInterval(function() {
setInterval(function () {
var x = (new Date()).getTime(),
y = e.getWithDefault("model.currentHashrate") / 1000000;
series.addPoint([x, y], true, true);
@ -32,7 +32,7 @@ export default Ember.Controller.extend({
text: ""
},
//////
rangeSelector : {
rangeSelector: {
enabled: true,
selected: 4,
allButtonsEnabled: true,
@ -132,7 +132,7 @@ export default Ember.Controller.extend({
},
},
tooltip: {
formatter: function() {
formatter: function () {
return this.y > 1000000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000000).toFixed(2) + "&nbsp;TH/s</b>" : this.y > 1000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000).toFixed(2) + "&nbsp;GH/s</b>" : this.y > 1000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000).toFixed(2) + "&nbsp;MH/s</b>" : "<b>" + this.point.d + "<b><br>Hashrate&nbsp;<b>" + this.y.toFixed(2) + "&nbsp;H/s</b>";
},
@ -145,7 +145,7 @@ export default Ember.Controller.extend({
series: [{
color: "#15BD27",
name: "3 hours average hashrate",
data: function() {
data: function () {
var e, a = [];
if (null != t) {
for (e = 0; e <= t.length - 1; e += 1) {
@ -173,7 +173,7 @@ export default Ember.Controller.extend({
}, {
name: "30 minutes average hashrate",
color: "#E99002",
data: function() {
data: function () {
var e, a = [];
if (null != t) {
for (e = 0; e <= t.length - 1; e += 1) {
@ -294,7 +294,7 @@ export default Ember.Controller.extend({
},
},
tooltip: {
formatter: function() {
formatter: function () {
return this.y > 1000000000000 ? "<b>" + this.point.d + "<b><br>Shares&nbsp;" + (this.y / 1000000000000) + "</b>" : this.y > 1000000000 ? "<b>" + this.point.d + "<b><br>Shares&nbsp;" + (this.y / 1000000000) + "</b>" : this.y > 1000000 ? "<b>" + this.point.d + "<b><br>Shares&nbsp;" + (this.y / 1000000) + "</b>" : "<b>" + this.point.d + "<b><br>Shares&nbsp;<b>" + this.y + "</b>";
},
@ -307,7 +307,7 @@ export default Ember.Controller.extend({
series: [{
color: "#15BD27",
name: "Valid share",
data: function() {
data: function () {
var e, a = [];
if (null != t) {
for (e = 0; e <= t.length - 1; e += 1) {
@ -337,7 +337,7 @@ export default Ember.Controller.extend({
name: "Stale share",
color: "#E99002",
data: function() {
data: function () {
var e, a = [];
if (null != t) {
for (e = 0; e <= t.length - 1; e += 1) {
@ -402,5 +402,36 @@ export default Ember.Controller.extend({
};
return a;
}
})
}),
earnPerHour: Ember.computed('model', {
get() {
return 1 * 60 * 60 / this.get('config').BlockTime * this.get('config').BlockReward *
this.getWithDefault('model.hashrate') / this.get('hashrate');
}
}),
earnPerHour12: Ember.computed('model', {
get() {
return 12 * 60 * 60 / this.get('config').BlockTime * this.get('config').BlockReward *
this.getWithDefault('model.hashrate') / this.get('hashrate');
}
}),
earnPerDay: Ember.computed('model', {
get() {
return 24 * 60 * 60 / this.get('config').BlockTime * this.get('config').BlockReward *
this.getWithDefault('model.hashrate') / this.get('hashrate');
}
}),
earnPerWeek: Ember.computed('model', {
get() {
return 168 * 60 * 60 / this.get('config').BlockTime * this.get('config').BlockReward *
this.getWithDefault('model.hashrate') / this.get('hashrate');
}
}),
earnPerMonth: Ember.computed('model', {
get() {
return 672 * 60 * 60 / this.get('config').BlockTime * this.get('config').BlockReward *
this.getWithDefault('model.hashrate') / this.get('hashrate');
}
}),
});

30
www/app/templates/account/index.hbs

@ -1,6 +1,36 @@
<div class="container">
{{high-charts mode=chartMode chartOptions=chartOptions content=chartData}}
{{high-charts mode=chartMode chartOptions=shareChart content=chartData}}
<table class="table table-condensed table-striped">
<thead>
<tr class="active">
<th>Time</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td><span>Last 60 minutes</span></td>
<td><span>{{format-number earnPerHour maximumFractionDigits='8'}}</span></td>
</tr>
<tr>
<td><span>Last 12 hours</span></td>
<td><span>{{format-number earnPerHour12 maximumFractionDigits='8'}}</span></td>
</tr>
<tr>
<td><span>Last 24 hours</span></td>
<td>{{format-number earnPerDay maximumFractionDigits='8'}}</td>
</tr>
<tr>
<td><span>Last 7 days</span></td>
<td>{{format-number earnPerWeek maximumFractionDigits='8'}}</td>
</tr>
<tr>
<td><span>Last 30 days</span></td>
<td>{{format-number earnPerMonth maximumFractionDigits='8'}}</td>
</tr>
</tbody>
</table>
{{#if model.workers}}
<h4>Your Workers</h4>
<div class="table-responsive">

Loading…
Cancel
Save