diff --git a/storage/redis.go b/storage/redis.go index 4eece70..60d057e 100644 --- a/storage/redis.go +++ b/storage/redis.go @@ -541,6 +541,7 @@ func (r *RedisClient) WriteBlock(login, id string, params []string, diff, roundD r.writeShare(tx, ms, ts, login, id, diff, window) tx.HSet(r.formatKey("stats"), "lastBlockFound", strconv.FormatInt(ts, 10)) tx.HDel(r.formatKey("stats"), "roundShares") + tx.HSet(r.formatKey("miners", login), "roundShares", strconv.FormatInt(0, 10)) tx.ZIncrBy(r.formatKey("finders"), 1, login) tx.HIncrBy(r.formatKey("miners", login), "blocksFound", 1) tx.HGetAllMap(r.formatKey("shares", "roundCurrent")) @@ -592,6 +593,7 @@ func (r *RedisClient) writeShare(tx *redis.Multi, ms, ts int64, login, id string tx.LPush(r.formatKey("lastshares"), login) } tx.LTrim(r.formatKey("lastshares"), 0, r.pplns) + tx.HIncrBy(r.formatKey("miners", login), "roundShares", diff) tx.HIncrBy(r.formatKey("shares", "roundCurrent"), login, diff) tx.ZAdd(r.formatKey("hashrate"), redis.Z{Score: float64(ts), Member: join(diff, login, id, ms)}) tx.ZAdd(r.formatKey("hashrate", login), redis.Z{Score: float64(ts), Member: join(diff, id, ms)}) @@ -1674,7 +1676,7 @@ func (r *RedisClient) getSharesStatus(login string, id string) (int64, int64, in } -//lets try to fuck without understanding and see if it works +// lets try to fuck without understanding and see if it works func (r *RedisClient) WriteWorkerShareStatus(login string, id string, valid bool, stale bool, invalid bool) { valid_int := 0 diff --git a/www/app/controllers/account.js b/www/app/controllers/account.js index c952d23..e8f7200 100644 --- a/www/app/controllers/account.js +++ b/www/app/controllers/account.js @@ -4,6 +4,16 @@ export default Ember.Controller.extend({ applicationController: Ember.inject.controller('application'), stats: Ember.computed.reads('applicationController.model.stats'), + PersonalLuck: Ember.computed("stats", "model", { + get() { + var percent = this.get("model.stats.roundShares") / this.get("applicationController.difficulty"); + if (!percent) { + return 0; + } + return percent; + }, + }), + roundPercent: Ember.computed('stats', 'model', { get() { var percent = this.get('model.roundShares') / this.get('stats.nShares'); diff --git a/www/app/templates/account.hbs b/www/app/templates/account.hbs index 280c8a4..eddc639 100644 --- a/www/app/templates/account.hbs +++ b/www/app/templates/account.hbs @@ -28,6 +28,8 @@
Workers Online: {{format-number model.workersOnline}}
Hashrate (30m): {{format-hashrate model.currentHashrate}}
Hashrate (3h): {{format-hashrate model.hashrate}}
+
Personal Luck: {{format-number PersonalLuck style='percent'}}
+
Blocks Found: {{format-number model.stats.blocksFound fallback='0'}}