|
|
@ -5796,7 +5796,7 @@ static char *cmd_marks(PGconn *conn, char *cmd, char *id, |
|
|
|
char description[TXT_BIG+1] = { '\0' }; |
|
|
|
char description[TXT_BIG+1] = { '\0' }; |
|
|
|
char extra[TXT_BIG+1] = { '\0' }; |
|
|
|
char extra[TXT_BIG+1] = { '\0' }; |
|
|
|
char status[TXT_FLAG+1] = { MARK_READY, '\0' }; |
|
|
|
char status[TXT_FLAG+1] = { MARK_READY, '\0' }; |
|
|
|
bool ok; |
|
|
|
bool ok = false, pps; |
|
|
|
|
|
|
|
|
|
|
|
LOGDEBUG("%s(): cmd '%s'", __func__, cmd); |
|
|
|
LOGDEBUG("%s(): cmd '%s'", __func__, cmd); |
|
|
|
|
|
|
|
|
|
|
@ -6237,6 +6237,39 @@ static char *cmd_marks(PGconn *conn, char *cmd, char *id, |
|
|
|
old ? "On" : "Off", |
|
|
|
old ? "On" : "Off", |
|
|
|
markersummary_auto ? "On" : "Off"); |
|
|
|
markersummary_auto ? "On" : "Off"); |
|
|
|
ok = true; |
|
|
|
ok = true; |
|
|
|
|
|
|
|
} else if (strcasecmp(action, "pps") == 0) { |
|
|
|
|
|
|
|
/* Recalculate a shift's rewards/rewarded
|
|
|
|
|
|
|
|
* Require markerid */ |
|
|
|
|
|
|
|
i_markerid = require_name(trf_root, "markerid", 1, |
|
|
|
|
|
|
|
(char *)intpatt, reply, siz); |
|
|
|
|
|
|
|
if (!i_markerid) |
|
|
|
|
|
|
|
return strdup(reply); |
|
|
|
|
|
|
|
TXT_TO_BIGINT("markerid", transfer_data(i_markerid), markerid); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
K_RLOCK(workmarkers_free); |
|
|
|
|
|
|
|
wm_item = find_workmarkerid(markerid, false, MARKER_PROCESSED); |
|
|
|
|
|
|
|
K_RUNLOCK(workmarkers_free); |
|
|
|
|
|
|
|
if (!wm_item) { |
|
|
|
|
|
|
|
snprintf(reply, siz, "no markerid %"PRId64, markerid); |
|
|
|
|
|
|
|
return strdup(reply); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
DATA_WORKMARKERS(workmarkers, wm_item); |
|
|
|
|
|
|
|
pps = shift_rewards(wm_item); |
|
|
|
|
|
|
|
if (pps) { |
|
|
|
|
|
|
|
snprintf(msg, sizeof(msg), |
|
|
|
|
|
|
|
"shift '%s' markerid %"PRId64" rewards %d " |
|
|
|
|
|
|
|
"rewarded %.3e pps %.3e", |
|
|
|
|
|
|
|
workmarkers->description, |
|
|
|
|
|
|
|
workmarkers->markerid, workmarkers->rewards, |
|
|
|
|
|
|
|
workmarkers->rewarded, workmarkers->pps_value); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
snprintf(msg, sizeof(msg), |
|
|
|
|
|
|
|
"shift '%s' markerid %"PRId64" no rewards yet" |
|
|
|
|
|
|
|
" pps %.3e", |
|
|
|
|
|
|
|
workmarkers->description, |
|
|
|
|
|
|
|
workmarkers->markerid, workmarkers->pps_value); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ok = true; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
snprintf(reply, siz, "unknown action '%s'", action); |
|
|
|
snprintf(reply, siz, "unknown action '%s'", action); |
|
|
|
LOGERR("%s.%s", id, reply); |
|
|
|
LOGERR("%s.%s", id, reply); |
|
|
|