diff --git a/wrenchboard/src/shared_tool/jobs.cc b/wrenchboard/src/shared_tool/jobs.cc index 670dd0c4..ad85f1d7 100644 --- a/wrenchboard/src/shared_tool/jobs.cc +++ b/wrenchboard/src/shared_tool/jobs.cc @@ -507,12 +507,19 @@ long WrenchUserJobsInterestList(CVars in, CVars &out) { long WrenchJobsInterestStats(CVars in, CVars &out) { long ret = PHP_API_BAD_PARAM; char vname[30]; + float pcnt = 0; //out = in; + float x = 0.61; + char buf[10]; + sprintf(buf, "Test=%.2f", x); + printf(buf); + + try { out["job_completed"] = "0"; out["job_active"] = "0"; - out["job_percent_complete"] = "0"; + out["job_percent_complete"] = "0.0 %"; out["job_uncompleted"] = "0"; out["job_rejected"] = "0"; out["job_pending"] = "0"; @@ -526,12 +533,14 @@ try { load_db_record(out, "SELECT count(id) AS job_pending FROM members_jobs_offer WHERE client_id = %lu AND expire > now()", out["client_id"].Long()); //pending jobs load_db_record(out, "SELECT count(id) job_active FROM members_jobs_contract WHERE client_id = %lu AND delivery_date> now() AND status = 1", out["client_id"].Long()); //job_active - load_db_record(out, "SELECT delivery_date AS job_last_date FROM members_jobs_contract WHERE client_id = %lu AND status =7 ORDER BY delivery_date DESC LIMIT 1", out["client_id"].Long()); //job_active - - - - + load_db_record(out, "SELECT delivery_date::date AS job_last_date FROM members_jobs_contract WHERE client_id = %lu AND status =7 ORDER BY delivery_date DESC LIMIT 1", out["client_id"].Long()); //job_active + load_db_record(out, "SELECT count(id) AS total_complete FROM members_jobs_contract WHERE client_id = %lu AND status =7", out["client_id"].Long()); //pending jobs + if ( out["total_complete"].Long() > 0 ){ + load_db_record(out, "SELECT count(id) AS total_jobs FROM members_jobs_contract WHERE client_id = %lu AND ststus IN (7,4,5)", out["client_id"].Long()); //pendi + sprintf(buf, "%.2f %", 100* out["total_complete"].Long() / out["total_jobs"].Long()); + out["job_percent_complete"] = buf; + } } // SELECT id as client_id FROM members WHERE uid::text = 'dfc9d601-780f-4d78-839f-422f0928f911'; diff --git a/www-api/app/Config/RoutesV1.php b/www-api/app/Config/RoutesV1.php index 3a211190..d0e3d88e 100644 --- a/www-api/app/Config/RoutesV1.php +++ b/www-api/app/Config/RoutesV1.php @@ -109,7 +109,7 @@ $routes->post('/en/wrench/api/v1/familywallet', 'WrenchWal $routes->post('/en/wrench/api/v1/familyresources', 'WrenchResources::familyresources'); $routes->post('/en/wrench/api/v1/commonmedia', 'WrenchResources::commonmedia'); -$routes->post('/en/wrench/api/v1/familybanners', 'WrenchFamily::familyBanners'); +$routes->post('/en/wrench/api/v1/familybanners', 'WrenchFamily::familyBanners'); $routes->post('/en/wrench/api/v1/familysampletasks', 'WrenchFamily::familySampleTasks');