From 6adbec85506e916b025ff41e7b8eed6a2630f3b2 Mon Sep 17 00:00:00 2001 From: kanoi Date: Sat, 5 Sep 2015 03:15:33 +1000 Subject: [PATCH] cdb/php - add a red line under the last payout on the shifts page --- pool/inc.php | 2 ++ pool/page_shifts.php | 8 ++++++-- src/ckdb.h | 2 +- src/ckdb_cmd.c | 13 ++++++++++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/pool/inc.php b/pool/inc.php index ad8819a0..5ae064df 100644 --- a/pool/inc.php +++ b/pool/inc.php @@ -117,7 +117,9 @@ h1 {margin-top:20px;float:middle;font-size:20px;} .foot, .push {height:50px;} .title {background-color:#909090;} .even {background-color:#cccccc;} +.evenu td {background-color:#cccccc;border-bottom:2px solid red;} .odd {background-color:#a8a8a8;} +.oddu td {background-color:#a8a8a8;border-bottom:2px solid red;} .hid {display:none;} .dl {text-align:left;padding:2px 8px;} .dr {text-align:right;padding:2px 8px;} diff --git a/pool/page_shifts.php b/pool/page_shifts.php index 40cc94ff..1be0d587 100644 --- a/pool/page_shifts.php +++ b/pool/page_shifts.php @@ -27,10 +27,14 @@ function doshifts($data, $user) $pg = '

Last '.($count+1).' Shifts

'.$pg; for ($i = 0; $i < $count; $i++) { + $u = ''; + if (isset($ans['lastpayoutstart:'.$i]) + && $ans['lastpayoutstart:'.$i] != '') + $u = 'u'; if (($i % 2) == 0) - $row = 'even'; + $row = "even$u"; else - $row = 'odd'; + $row = "odd$u"; $pg .= ""; $shifname = $ans['shift:'.$i]; diff --git a/src/ckdb.h b/src/ckdb.h index e98cf5ef..7a5448be 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -55,7 +55,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.2" -#define CKDB_VERSION DB_VERSION"-1.232" +#define CKDB_VERSION DB_VERSION"-1.233" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c index f724b218..a94abd60 100644 --- a/src/ckdb_cmd.c +++ b/src/ckdb_cmd.c @@ -5143,6 +5143,7 @@ static char *cmd_shifts(__maybe_unused PGconn *conn, char *cmd, char *id, int rows, want, i, where_all; int64_t maxrows; double wm_count, d; + int64_t last_payout_start = 0; LOGDEBUG("%s(): cmd '%s'", __func__, cmd); @@ -5169,6 +5170,7 @@ static char *cmd_shifts(__maybe_unused PGconn *conn, char *cmd, char *id, wm_count *= 1.42; if (maxrows < wm_count) maxrows = wm_count; + last_payout_start = payouts->workinfoidstart; } i_select = optional_name(trf_root, "select", 1, NULL, reply, siz); @@ -5360,6 +5362,14 @@ static char *cmd_shifts(__maybe_unused PGconn *conn, char *cmd, char *id, rows, wm->rewards, FLDSEP); APPEND_REALLOC(buf, off, len, tmp); + snprintf(tmp, sizeof(tmp), "lastpayoutstart:%d=%s%c", + rows, + (wm->workinfoidstart == + last_payout_start) ? + "Y" : EMPTY, + FLDSEP); + APPEND_REALLOC(buf, off, len, tmp); + rows++; // Setup for next shift @@ -5399,7 +5409,8 @@ static char *cmd_shifts(__maybe_unused PGconn *conn, char *cmd, char *id, * other workers start >= 0 and finish <= rows-1 */ snprintf(tmp, sizeof(tmp), "rows=%d%cflds=%s%c", rows, FLDSEP, - "markerid,shift,start,end,rewards", FLDSEP); + "markerid,shift,start,end,rewards," + "lastpayoutstart", FLDSEP); APPEND_REALLOC(buf, off, len, tmp); snprintf(tmp, sizeof(tmp), "arn=%s", "Shifts");