Browse Source

ckdb - correct summarisation

master
kanoi 10 years ago
parent
commit
bc19c266b9
  1. 34
      src/ckdb.c

34
src/ckdb.c

@ -4559,7 +4559,7 @@ static bool userstats_add_db(PGconn *conn, USERSTATS *row)
PGresult *res; PGresult *res;
char *ins; char *ins;
bool ok = false; bool ok = false;
char *params[9 + HISTORYDATECOUNT]; char *params[9 + SIMPLEDATECOUNT];
int par; int par;
int n; int n;
@ -6671,27 +6671,27 @@ static void summarise_userstats()
count = 1; count = 1;
while (next) { while (next) {
if (DATA_USERSTATS(next)->userid != userstats->userid)
break;
if (strcmp(DATA_USERSTATS(next)->workername, userstats->workername))
break;
statrange = tvdiff(&when, &(DATA_USERSTATS(next)->statsdate)); statrange = tvdiff(&when, &(DATA_USERSTATS(next)->statsdate));
if (statrange <= 0) if (statrange <= 0)
break; break;
count++;
userstats->hashrate += DATA_USERSTATS(next)->hashrate;
userstats->hashrate5m += DATA_USERSTATS(next)->hashrate5m;
userstats->hashrate1hr += DATA_USERSTATS(next)->hashrate1hr;
userstats->hashrate24hr += DATA_USERSTATS(next)->hashrate24hr;
if (userstats->elapsed > DATA_USERSTATS(next)->elapsed)
userstats->elapsed = DATA_USERSTATS(next)->elapsed;
tmp = next_in_ktree(ctx); tmp = next_in_ktree(ctx);
remove_from_ktree(userstats_root, next, cmp_userstats, ctx2);
remove_from_ktree(userstats_statsdate_root, next, cmp_userstats_statsdate, ctx2); if (DATA_USERSTATS(next)->userid == userstats->userid &&
k_unlink_item(userstats_store, next); strcmp(DATA_USERSTATS(next)->workername, userstats->workername)) {
k_add_head(userstats_summ, next); count++;
userstats->hashrate += DATA_USERSTATS(next)->hashrate;
userstats->hashrate5m += DATA_USERSTATS(next)->hashrate5m;
userstats->hashrate1hr += DATA_USERSTATS(next)->hashrate1hr;
userstats->hashrate24hr += DATA_USERSTATS(next)->hashrate24hr;
if (userstats->elapsed > DATA_USERSTATS(next)->elapsed)
userstats->elapsed = DATA_USERSTATS(next)->elapsed;
remove_from_ktree(userstats_root, next, cmp_userstats, ctx2);
remove_from_ktree(userstats_statsdate_root, next, cmp_userstats_statsdate, ctx2);
k_unlink_item(userstats_store, next);
k_add_head(userstats_summ, next);
}
next = tmp; next = tmp;
} }

Loading…
Cancel
Save