From 1d9ebdf94a0cbb5b7e3dea4eaf8e65d973e46961 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 7 Nov 2024 05:07:07 -0500 Subject: [PATCH] Added past due task --- wrenchboard/src/shared_tool/reco_egine.cc | 72 +++++++++++++++++++++-- 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/wrenchboard/src/shared_tool/reco_egine.cc b/wrenchboard/src/shared_tool/reco_egine.cc index 1cda563b..3771bffd 100644 --- a/wrenchboard/src/shared_tool/reco_egine.cc +++ b/wrenchboard/src/shared_tool/reco_egine.cc @@ -104,7 +104,7 @@ long WrenchFamilyHomeBanners(CVars in, CVars &out){ if(itm_count < 3){ // if( RecoLearnMore( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } // if( RecoPlayGround( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } -// if( RecoReferAFreind( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } + if( RecoReferAFreind( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } // if( RecoCheckBlog( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } } @@ -116,7 +116,71 @@ long WrenchFamilyHomeBanners(CVars in, CVars &out){ long RecoCheckFamilyOffers( int itm_count, CVars in, CVars &out ){ return 0;} long RecoCheckFamilyActive( int itm_count, CVars in, CVars &out ){ return 0;} -long RecoFamilyPastDueTask( int itm_count, CVars in, CVars &out ){ return 0;} + +/* +Family past due tasks +*/ +long RecoFamilyPastDueTask( int itm_count, CVars in, CVars &out ){ + logfmt(logINFO, "RecoFamilyPastDueTask()"); + 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 '2880 minutes' ) ",member_id); + if (res != NULL && pgsql_num_rows(res) > 0) { + + snprintf(vname, sizeof (vname), "title_%05d", ic); + out[vname] = "Past Due Tasks"; + + snprintf(vname, sizeof (vname), "description_%05d", ic); + out[vname] = "Request an extension 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/kids/banner-pastdue.jpg"; + + snprintf(vname, sizeof (vname), "banner_location_%05d", ic); + out[vname] ="URL"; + + snprintf(vname, sizeof (vname), "link_path_%05d", ic); + out[vname] = "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] = "You have some 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, "/RecoFamilyPastDueTask()"); + return ret; + } /* Task sent to parent , waiting to start @@ -129,7 +193,7 @@ long RecoFamilyKidsWaiting( int itm_count, CVars in, CVars &out ){ try { int ic = itm_count; long member_id = REQ_LONG(in, "member_id", 1, -1); - res = pgsql_query("SELECT * FROM members_family_suggesttask WHERE family_uid::text IN (SELECT uid::text FROM members_family WHERE member_id = %lu ) AND status IN ( 1,2,3,4,5) ", member_id); + res = pgsql_query("SELECT * FROM members_family_suggesttask WHERE member_id = %lu AND status = 1 LIMIT 5", member_id); if (res != NULL && pgsql_num_rows(res) > 0) { snprintf(vname, sizeof (vname), "title_%05d", ic); @@ -574,7 +638,7 @@ long RecoRecentPastDueTask( int itm_count, CVars in, CVars &out ){ out[vname] = "Past Due Tasks"; snprintf(vname, sizeof (vname), "short_description_%05d", ic); - out[vname] = "View you have past due task(s) "; + out[vname] = "View your past due task(s) "; snprintf(vname, sizeof (vname), "short_style_%05d", ic); out[vname] = "short_style lr";