diff --git a/wrenchboard/src/shared_tool/reco_egine.cc b/wrenchboard/src/shared_tool/reco_egine.cc index e906a0b6..02c32fc9 100644 --- a/wrenchboard/src/shared_tool/reco_egine.cc +++ b/wrenchboard/src/shared_tool/reco_egine.cc @@ -45,6 +45,7 @@ long RecoStartMarketCardUS( int itm_count, CVars in, CVars &out ); long RecoLearnMore( int itm_count, CVars in, CVars &out ); long RecoJobOwner( int itm_count, CVars in, CVars &out ); long RecoFamilyWaiting( int itm_count, CVars in, CVars &out ); +long RecoRecentPastDueTask( int itm_count, CVars in, CVars &out ); long recommendation_engine(long action , CVars in, CVars &out) { try{ @@ -94,6 +95,7 @@ long WrenchHomeBanners(CVars in, CVars &out) { char vname[30]; long member_id = REQ_LONG(in, "member_id", 1, -1); int itm_count= 0; + if( RecoRecentPastDueTask( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } if( RecoFamilyWaiting( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } if( RecoCheckOffers( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } /*ONLY IF OFFER IS GREATER THAN 2 */ if( RecoCheckActiveTask( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } @@ -301,6 +303,68 @@ long RecoJobOwner( int itm_count, CVars in, CVars &out ){ return 0; } +long RecoRecentPastDueTask( int itm_count, CVars in, CVars &out ){ + logfmt(logINFO, "RecoRecentPastDueTask()"); + long ret = PHP_API_BAD_PARAM; + const PGresult *res; + char vname[30]; + try { + int ic = itm_count; + long member_id = REQ_LONG(in, "member_id", 1, -1); + res = pgsql_query("SELECT * FROM members_jobs_contract WHERE client_id = %lu AND status =1 AND delivery_date< now() AND delivery_date > ( now() - interval '1440 minutes' ) ",member_id); + if (res != NULL && pgsql_num_rows(res) > 0) { + + snprintf(vname, sizeof (vname), "title_%05d", ic); + out[vname] = "You recently past due task(s) "; + + snprintf(vname, sizeof (vname), "description_%05d", ic); + out[vname] = "Request an extension of 12 hours before the task gets canceled."; + + snprintf(vname, sizeof (vname), "card_type_%05d", ic); + out[vname] = "PASTDUEJOB"; + + snprintf(vname, sizeof (vname), "offer_id_%05d", ic); + out[vname] = "0"; + + snprintf(vname, sizeof (vname), "blog_id_%05d", ic); + out[vname] = "0"; + + snprintf(vname, sizeof (vname), "card_icon_%05d", ic); + out[vname] = "icon1"; + + snprintf(vname, sizeof (vname), "banner_%05d", ic); + out[vname] ="https://www.wrenchboard.com/assets/images/apps/banners/pastdue-jobs.jpg"; + + snprintf(vname, sizeof (vname), "banner_location_%05d", ic); + out[vname] ="URL"; + + snprintf(vname, sizeof (vname), "link_path_%05d", ic); + out[vname] = "mytask?tab=pastdue"; //Active Task Page //"my-active-jobs"; + + snprintf(vname, sizeof (vname), "button_text_%05d", ic); + out[vname] = "View Tasks"; + + snprintf(vname, sizeof (vname), "short_button_text_%05d", ic); + out[vname] = "View"; + + snprintf(vname, sizeof (vname), "short_title_%05d", ic); + out[vname] = "past Due Tasks"; + + snprintf(vname, sizeof (vname), "short_description_%05d", ic); + out[vname] = "View you have past due task(s) "; + + snprintf(vname, sizeof (vname), "short_style_%05d", ic); + out[vname] = "short_style lr"; + + ret = PHP_API_OK; + } + } catch (bad_parameter) { + out["status"] = "ERROR"; + } + logfmt(logINFO, "/RecoRecentPastDueTask()"); +return ret; +} + long RecoStartMarketCardUS( int itm_count, CVars in, CVars &out ){ logfmt(logINFO, "RecoStartMarketCardUS()"); long ret = PHP_API_BAD_PARAM;