Browse Source

ckdb - correct summarisation

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

12
src/ckdb.c

@ -4559,7 +4559,7 @@ static bool userstats_add_db(PGconn *conn, USERSTATS *row)
PGresult *res;
char *ins;
bool ok = false;
char *params[9 + HISTORYDATECOUNT];
char *params[9 + SIMPLEDATECOUNT];
int par;
int n;
@ -6671,14 +6671,14 @@ static void summarise_userstats()
count = 1;
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));
if (statrange <= 0)
break;
tmp = next_in_ktree(ctx);
if (DATA_USERSTATS(next)->userid == userstats->userid &&
strcmp(DATA_USERSTATS(next)->workername, userstats->workername)) {
count++;
userstats->hashrate += DATA_USERSTATS(next)->hashrate;
userstats->hashrate5m += DATA_USERSTATS(next)->hashrate5m;
@ -6687,11 +6687,11 @@ static void summarise_userstats()
if (userstats->elapsed > DATA_USERSTATS(next)->elapsed)
userstats->elapsed = DATA_USERSTATS(next)->elapsed;
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);
k_unlink_item(userstats_store, next);
k_add_head(userstats_summ, next);
}
next = tmp;
}

Loading…
Cancel
Save