diff --git a/wrenchboard/src/shared_tool/jobs_manager.cc b/wrenchboard/src/shared_tool/jobs_manager.cc index d299439b..c09f4120 100644 --- a/wrenchboard/src/shared_tool/jobs_manager.cc +++ b/wrenchboard/src/shared_tool/jobs_manager.cc @@ -318,13 +318,14 @@ long WrenchJobManagerActiveTasksList(CVars in, CVars &out) { const PGresult *res; res = pgsql_query("SELECT mc.id AS contract_id, mc.job_id AS job_id, mc.price, mc.timeline_days,mc.contract, " " mj.title, mj.description AS description,mc.job_detail AS job_description, " - " (CASE WHEN mc.status=4 THEN 'Review' " - " WHEN mc.status = 1 AND mc.delivery_date > now() THEN 'Active' " - " WHEN mc.status = 1 AND mc.delivery_date < now() THEN 'Past Due' " - " ELSE 'Others' END) AS status_description,mc.delivery_date " + " (CASE WHEN mc.status=4 THEN 'REVIEW' " + " WHEN mc.status = 1 AND mc.delivery_date > now() THEN 'ACTIVE' " + " WHEN mc.status = 1 AND mc.delivery_date < now() THEN 'PASTDUE' " + " ELSE 'OTHERS' END) AS status_description,mc.delivery_date, " + " (CASE WHEN mc.member_id = %lu THEN 'OWNER' ELSE 'WORKER' END) AS owner_status " " FROM members_jobs_contract mc LEFT JOIN members_jobs mj ON mj.id = mc.job_id LEFT JOIN members m ON m.id=mc.client_id " " WHERE mc.member_id =%lu %s AND mc.status IN (1,2,4) %s " - " ORDER BY mc.id DESC LIMIT %lu OFFSET %lu", in["member_id"].Long(),extra_filter, status_filter, limit, offset); + " ORDER BY mc.id DESC LIMIT %lu OFFSET %lu", member_id, member_id ,extra_filter, status_filter, limit, offset); //ORDER BY id DESC LIMIT %lu OFFSET %lu", in["member_id"].Long(), limit, offset); if (res != NULL && pgsql_num_rows(res) > 0) { out["total_record"] = pgsql_num_rows(res); @@ -379,6 +380,10 @@ long WrenchJobManagerActiveTasksList(CVars in, CVars &out) { snprintf(vname, sizeof (vname), "contract_id_%05d", i); out[vname] = rec["contract_id"]; + + snprintf(vname, sizeof (vname), "owner_status_%05d", i); + out[vname] = rec["owner_status"]; + } } ret = PHP_API_OK; @@ -410,13 +415,14 @@ long WrenchUsersActiveTasksList(CVars in, CVars &out) { res = pgsql_query("SELECT mc.id AS contract_id, mc.job_id AS job_id, mc.price, mc.timeline_days,mc.contract, " " mj.title, mj.description AS description,mc.job_detail AS job_description, " - " (CASE WHEN mc.status=4 THEN 'Review' " - " WHEN mc.status = 1 AND mc.delivery_date > now() THEN 'Active' " - " WHEN mc.status = 1 AND mc.delivery_date now() THEN 'ACTIVE' " + " WHEN mc.status = 1 AND mc.delivery_date now() " - " ORDER BY mc.id DESC LIMIT %lu OFFSET %lu", in["member_id"].Long(), limit, offset); + " ORDER BY mc.id DESC LIMIT %lu OFFSET %lu",member_id, member_id, limit, offset); //ORDER BY id DESC LIMIT %lu OFFSET %lu", in["member_id"].Long(), limit, offset); if (res != NULL && pgsql_num_rows(res) > 0) { out["total_record"] = pgsql_num_rows(res); diff --git a/www-api/app/Models/ResultFormatter.php b/www-api/app/Models/ResultFormatter.php index e8cc6f76..41b3380d 100644 --- a/www-api/app/Models/ResultFormatter.php +++ b/www-api/app/Models/ResultFormatter.php @@ -301,6 +301,7 @@ class ResultFormatter extends Model "contract" => $out["contract_${key}"], "status_description" => $out["status_description_${key}"], "delivery_date" => $out["delivery_date_${key}"], + "owner_status" => $out["owner_status_${key}"], "offer_uid" => $out["offer_uid_${key}"], "job_uid" => $out["job_uid_${key}"], "expire" => $out["expire_${key}"], diff --git a/www-api/public/svs/user/formarter.php b/www-api/public/svs/user/formarter.php index 24c05d9a..8151d980 100755 --- a/www-api/public/svs/user/formarter.php +++ b/www-api/public/svs/user/formarter.php @@ -337,6 +337,7 @@ function processOutJson($in, $out) { "contract" => $out["contract_${key}"], "status_description" => $out["status_description_${key}"], "delivery_date" => $out["delivery_date_${key}"], + "owner_status" => $out["owner_status_${key}"], "offer_uid" => $out["offer_uid_${key}"], "job_uid" => $out["job_uid_${key}"], "expire" => $out["expire_${key}"],