More data fixes....

This commit is contained in:
Alexander Blair
2017-05-19 17:38:27 -07:00
parent e6cf90a230
commit 7e800538d8
+9 -8
View File
@@ -201,10 +201,11 @@ function Database(){
minerID = minerID + '.' + share.paymentID; minerID = minerID + '.' + share.paymentID;
} }
let minerIDWithIdentifier = minerID + "_" + share.identifier; let minerIDWithIdentifier = minerID + "_" + share.identifier;
if (!cachedData.global_stats.hasOwnProperty('totalHashes')){ // this.incrementCacheData('global_stats', [{location: 'totalHashes', value: share.shares}, {location: 'roundHashes', value: share.shares}]);
if (!cachedData.global_stats.hasOwnProperty('totalHashes') || cachedData.global_stats.totalHashes === null){
cachedData.global_stats.totalHashes = 0; cachedData.global_stats.totalHashes = 0;
} }
if (!cachedData.global_stats.hasOwnProperty('roundHashes')){ if (!cachedData.global_stats.hasOwnProperty('roundHashes') || cachedData.global_stats.roundHashes === null){
cachedData.global_stats.roundHashes = 0; cachedData.global_stats.roundHashes = 0;
} }
cachedData.global_stats.totalHashes += share.shares; cachedData.global_stats.totalHashes += share.shares;
@@ -221,10 +222,10 @@ function Database(){
stats_type = 'solo_stats'; stats_type = 'solo_stats';
break; break;
} }
if (!cachedData[stats_type].hasOwnProperty('totalHashes')){ if (!cachedData[stats_type].hasOwnProperty('totalHashes') || cachedData[stats_type].totalHashes === null){
cachedData[stats_type].totalHashes = 0; cachedData[stats_type].totalHashes = 0;
} }
if (!cachedData[stats_type].hasOwnProperty('roundHashes')){ if (!cachedData[stats_type].hasOwnProperty('roundHashes') || cachedData[stats_type].roundHashes === null){
cachedData[stats_type].roundHashes = 0; cachedData[stats_type].roundHashes = 0;
} }
cachedData[stats_type].totalHashes += share.shares; cachedData[stats_type].totalHashes += share.shares;
@@ -243,16 +244,16 @@ function Database(){
} }
cachedData[minerIDWithIdentifier] = minerCache; cachedData[minerIDWithIdentifier] = minerCache;
} }
if (!cachedData[minerIDWithIdentifier].hasOwnProperty('totalHashes')){ if (!cachedData[minerIDWithIdentifier].hasOwnProperty('totalHashes') || cachedData[minerIDWithIdentifier].totalHashes === null){
cachedData[minerIDWithIdentifier].totalHashes = 0; cachedData[minerIDWithIdentifier].totalHashes = 0;
} }
if (!cachedData[minerIDWithIdentifier].hasOwnProperty('goodShares')){ if (!cachedData[minerIDWithIdentifier].hasOwnProperty('goodShares') || cachedData[minerIDWithIdentifier].goodShares === null){
cachedData[minerIDWithIdentifier].goodShares = 0; cachedData[minerIDWithIdentifier].goodShares = 0;
} }
if (!cachedData[minerID].hasOwnProperty('totalHashes')){ if (!cachedData[minerID].hasOwnProperty('totalHashes') || cachedData[minerID].totalHashes === null){
cachedData[minerID].totalHashes = 0; cachedData[minerID].totalHashes = 0;
} }
if (!cachedData[minerID].hasOwnProperty('goodShares')){ if (!cachedData[minerID].hasOwnProperty('goodShares') || cachedData[minerID].goodShares === null){
cachedData[minerID].goodShares = 0; cachedData[minerID].goodShares = 0;
} }
cachedData[minerIDWithIdentifier].totalHashes += share.shares; cachedData[minerIDWithIdentifier].totalHashes += share.shares;