diff --git a/wrenchboard/src/shared_tool/reco_egine.cc b/wrenchboard/src/shared_tool/reco_egine.cc index 285a6652..1cda563b 100644 --- a/wrenchboard/src/shared_tool/reco_egine.cc +++ b/wrenchboard/src/shared_tool/reco_egine.cc @@ -51,7 +51,7 @@ long RecoPlayGround( int itm_count, CVars in, CVars &out ); // family banners long RecoCheckFamilyOffers( int itm_count, CVars in, CVars &out ); long RecoCheckFamilyActive( int itm_count, CVars in, CVars &out ); -long RecoRecentPastDueTask( int itm_count, CVars in, CVars &out ); +long RecoFamilyPastDueTask( int itm_count, CVars in, CVars &out ); long RecoFamilyKidsWaiting( int itm_count, CVars in, CVars &out ); long RecoRecomendToParent( int itm_count, CVars in, CVars &out ); @@ -96,7 +96,7 @@ long WrenchFamilyHomeBanners(CVars in, CVars &out){ int itm_count= 0; if( RecoCheckFamilyOffers( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } /*ONLY IF OFFER IS GREATER THAN 2 */ if( RecoCheckFamilyActive( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } - if( RecoRecentPastDueTask( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } + if( RecoFamilyPastDueTask( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } if( RecoFamilyKidsWaiting( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } if( RecoRecomendToParent( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } @@ -116,8 +116,74 @@ 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 RecoRecentPastDueTask( int itm_count, CVars in, CVars &out ){ return 0;} -long RecoFamilyKidsWaiting( int itm_count, CVars in, CVars &out ){ return 0;} +long RecoFamilyPastDueTask( int itm_count, CVars in, CVars &out ){ return 0;} + +/* +Task sent to parent , waiting to start +*/ +long RecoFamilyKidsWaiting( int itm_count, CVars in, CVars &out ){ + logfmt(logINFO, "RecoFamilyKidsWaiting()"); + 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_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); + if (res != NULL && pgsql_num_rows(res) > 0) { + + snprintf(vname, sizeof (vname), "title_%05d", ic); + out[vname] = "Waiting for Parent"; + + snprintf(vname, sizeof (vname), "description_%05d", ic); + out[vname] = "Waiting for parent to get started."; + + snprintf(vname, sizeof (vname), "card_type_%05d", ic); + out[vname] = "KIDS_SUGGEST"; + + 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 imp_offers"; + + snprintf(vname, sizeof (vname), "banner_%05d", ic); + out[vname] ="https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-suggested.jpg"; + + snprintf(vname, sizeof (vname), "banner_location_%05d", ic); + out[vname] ="URL"; + + snprintf(vname, sizeof (vname), "link_path_%05d", ic); + out[vname] = "parentwaiting"; + + snprintf(vname, sizeof (vname), "button_text_%05d", ic); + out[vname] = "Continue"; + + snprintf(vname, sizeof (vname), "short_button_text_%05d", ic); + out[vname] = "View"; + + snprintf(vname, sizeof (vname), "short_title_%05d", ic); + out[vname] = "Waiting for Parent."; + + snprintf(vname, sizeof (vname), "short_description_%05d", ic); + out[vname] = "Waiting for parent to get started."; + + snprintf(vname, sizeof (vname), "short_style_%05d", ic); + out[vname] = "short_style"; + + ret = PHP_API_OK; + } + + + } catch (bad_parameter) { + out["status"] = "ERROR"; + } + logfmt(logINFO, "/RecoFamilyKidsWaiting()"); + return ret; +} /* Show the banner for the kids to recommend to parent @@ -132,10 +198,10 @@ long RecoRecomendToParent( int itm_count, CVars in, CVars &out ){ int ic = itm_count; snprintf(vname, sizeof (vname), "title_%05d", ic); - out[vname] = "Learn more"; + out[vname] = "Recommend to Parent"; snprintf(vname, sizeof (vname), "description_%05d", ic); - out[vname] = "Need more information how it works ?"; + out[vname] = "Send to parent to approve"; snprintf(vname, sizeof (vname), "card_type_%05d", ic); out[vname] = "LEARN_MORE"; @@ -150,13 +216,13 @@ long RecoRecomendToParent( int itm_count, CVars in, CVars &out ){ out[vname] = "icon1 imp_offers"; snprintf(vname, sizeof (vname), "banner_%05d", ic); - out[vname] ="https://www.wrenchboard.com/assets/images/apps/banners/learnmore.jpg"; + out[vname] ="https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-recommend.jpg"; snprintf(vname, sizeof (vname), "banner_location_%05d", ic); out[vname] ="URL"; snprintf(vname, sizeof (vname), "link_path_%05d", ic); - out[vname] = "learnmore"; + out[vname] = "familymarket"; snprintf(vname, sizeof (vname), "button_text_%05d", ic); out[vname] = "View"; @@ -165,18 +231,16 @@ long RecoRecomendToParent( int itm_count, CVars in, CVars &out ){ out[vname] = "View"; snprintf(vname, sizeof (vname), "short_title_%05d", ic); - out[vname] = "Learn more"; + out[vname] = "Recommend to Parent"; snprintf(vname, sizeof (vname), "short_description_%05d", ic); - out[vname] = "Need more information how it works ?"; + out[vname] = "Suggest Task to the Parents"; snprintf(vname, sizeof (vname), "short_style_%05d", ic); out[vname] = "short_style"; ret = PHP_API_OK; - - } catch (bad_parameter) { out["status"] = "ERROR"; }