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; 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,14 +6671,14 @@ 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;
tmp = next_in_ktree(ctx);
if (DATA_USERSTATS(next)->userid == userstats->userid &&
strcmp(DATA_USERSTATS(next)->workername, userstats->workername)) {
count++; count++;
userstats->hashrate += DATA_USERSTATS(next)->hashrate; userstats->hashrate += DATA_USERSTATS(next)->hashrate;
userstats->hashrate5m += DATA_USERSTATS(next)->hashrate5m; userstats->hashrate5m += DATA_USERSTATS(next)->hashrate5m;
@ -6687,11 +6687,11 @@ static void summarise_userstats()
if (userstats->elapsed > DATA_USERSTATS(next)->elapsed) if (userstats->elapsed > DATA_USERSTATS(next)->elapsed)
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_root, next, cmp_userstats, ctx2);
remove_from_ktree(userstats_statsdate_root, next, cmp_userstats_statsdate, ctx2); remove_from_ktree(userstats_statsdate_root, next, cmp_userstats_statsdate, ctx2);
k_unlink_item(userstats_store, next); k_unlink_item(userstats_store, next);
k_add_head(userstats_summ, next); k_add_head(userstats_summ, next);
}
next = tmp; next = tmp;
} }

Loading…
Cancel
Save