diff --git a/GlobalVariable.py b/GlobalVariable.py index c8107a3..8cf2d20 100644 --- a/GlobalVariable.py +++ b/GlobalVariable.py @@ -184,4 +184,9 @@ elif (MYSY_ENV == "DEV"): """ Cette Variable definit le nombre de formation associées à retourner """ -LIMIT_ASSOCIATED_TRAINING = 3 \ No newline at end of file +LIMIT_ASSOCIATED_TRAINING = 3 + +""" +Valeur MAX du display ranking accordé aux compte de type demo +""" +DEMO_RANKING_VALUE = "50" \ No newline at end of file diff --git a/class_mgt.py b/class_mgt.py index ad4f46c..bb6c729 100644 --- a/class_mgt.py +++ b/class_mgt.py @@ -46,7 +46,7 @@ def add_class(diction): field_list = ['external_code', 'title', 'description', 'trainer', 'institut_formation', 'distantiel', 'presentiel', 'price', 'url','duration', 'duration_unit', 'token', 'plus_produit', 'mots_cle','domaine', 'internal_url', 'zone_diffusion', 'metier', 'date_lieu', 'published', 'img_url', 'objectif', - 'programme', 'prerequis'] + 'programme', 'prerequis', 'note'] incom_keys = diction.keys() for val in incom_keys: @@ -141,6 +141,10 @@ def add_class(diction): if diction['title']: mydata['title'] = diction['title'] + if ("note" in diction.keys()): + if diction['note']: + mydata['note'] = diction['note'] + if ("objectif" in diction.keys()): if diction['objectif']: mydata['objectif'] = diction['objectif'] @@ -253,7 +257,7 @@ def add_class(diction): if (not tmp_str2.endswith(";")): tmp_str2 = tmp_str2 + ";" - print("tmp_str2 = " + tmp_str2) + #print("tmp_str2 = " + tmp_str2) if (";" not in tmp_str2): @@ -306,7 +310,7 @@ def add_class(diction): if (not tmp_str2.endswith(";")): tmp_str2 = tmp_str2 + ";" - print("tmp_str2 = " + tmp_str2) + #print("tmp_str2 = " + tmp_str2) if (";" not in tmp_str2): mycommon.myprint(str(inspect.stack()[0][3]) + " - les dates et lieux de la formation : " + str( @@ -363,6 +367,23 @@ def add_class(diction): # Create internal ref. of class mydata['internal_code'] = mycommon.Create_internal_call_ref() + """ Gestion des ajout pr les compte utilisateur de type demo """ + + coll_partner_account = MYSY_GV.dbname['partnair_account'] + myquery = {"recid": str(mydata['partner_owner_recid']), "active": "1", + "demo_account": "1"} + + #print(" myquery pr demo_account = " + str(myquery)) + tmp = coll_partner_account.count_documents(myquery) + + if (tmp > 0): + mydata['display_rank'] = str(MYSY_GV.DEMO_RANKING_VALUE) + mydata['isalaune'] = "1" + #print(" myquery pr demo_account 222 = " + str(tmp)) + + + + coll_name = MYSY_GV.dbname['myclass'] ''' @@ -423,7 +444,7 @@ def update_class(diction): field_list = ['external_code', 'title', 'description', 'trainer', 'institut_formation', 'distantiel', 'presentiel','price', 'url', 'duration', 'token','plus_produit', 'mots_cle', 'domaine', 'internal_code', 'internal_url','zone_diffusion', 'metier', - 'date_lieu', 'published', 'img_url', 'objectif', 'programme', 'prerequis'] + 'date_lieu', 'published', 'img_url', 'objectif', 'programme', 'prerequis', 'note'] incom_keys = diction.keys() for val in incom_keys: @@ -488,6 +509,9 @@ def update_class(diction): if ("title" in diction.keys()): mydata['title'] = diction['title'] + if ("note" in diction.keys()): + mydata['note'] = diction['note'] + if ("objectif" in diction.keys()): mydata['objectif'] = diction['objectif'] @@ -565,7 +589,7 @@ def update_class(diction): if( not tmp_str2.endswith(";")): tmp_str2 = tmp_str2+";" - print("tmp_str2 = " + tmp_str2) + #print("tmp_str2 = " + tmp_str2) if (";" not in tmp_str2): mycommon.myprint(str(inspect.stack()[0][3]) + " - la zone de diffusion de la formation 0: " + str( @@ -671,6 +695,20 @@ def update_class(diction): mydata['indexed_desc'] = '0' mydata['indexed_obj'] = '0' + """ Gestion des ajout pr les compte utilisateur de type demo """ + + coll_partner_account = MYSY_GV.dbname['partnair_account'] + myquery = {"recid": str(user_recid), "active": "1", + "demo_account": "1"} + + #print(" myquery pr demo_account = " + str(myquery)) + tmp = coll_partner_account.count_documents(myquery) + + if (tmp > 0): + mydata['display_rank'] = str(MYSY_GV.DEMO_RANKING_VALUE) + mydata['isalaune'] = "1" + #print(" myquery pr demo_account 222 = " + str(tmp)) + coll_name = MYSY_GV.dbname['myclass'] @@ -2023,7 +2061,7 @@ def add_class_mass(file=None, Folder=None, diction=None): field_list = ['external_code', 'titre', 'description', 'formateur', 'institut_formation', 'distantiel', 'presentiel', 'prix', 'domaine', 'url','duree', 'plus_produit', 'mots_cle', 'zone_diffusion', 'metier', 'date_lieu', 'publie', 'img_url', - 'objectif', 'programme', 'prerequis'] + 'objectif', 'programme', 'prerequis', 'formateur', 'note'] total_rows = len(df) @@ -2089,6 +2127,10 @@ def add_class_mass(file=None, Folder=None, diction=None): if (str(df['objectif'].values[n])): mydata['objectif'] = str(df['objectif'].values[n]) + if ("note" in df.keys()): + if (str(df['note'].values[n])): + mydata['note'] = str(df['note'].values[n]) + if ("programme" in df.keys()): if (str(df['programme'].values[n])): mydata['programme'] = str(df['programme'].values[n]) @@ -2267,6 +2309,9 @@ def get_class_by_metier(diction): Cette fonction modifier le ranking des formations d'un partenaire en masse. Par exemple, lorqu'il change d'abonnement et passe du standard au gold, toutes ses formation prenne le ranking des golds. + +/!\ : Si le compte utilisateur est un compte de demo, le display_ranking prendra +une valeur max de 50. ceci pour que ses formations soient visibles tout de suite. """ def UpdataPartnerRankingClass(diction): try: @@ -2284,6 +2329,7 @@ def UpdataPartnerRankingClass(diction): str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ") return False, "Impossible de mettre à jour le rang des formations" + # Recuperation du rang associé au pack new_ranking_value = "" @@ -2308,11 +2354,29 @@ def UpdataPartnerRankingClass(diction): diction["new_pack_name"]) + " n'est pas paramettré corretement - V2") return False, "Impossible de mettre à jour le rang des formations" + """ + Verification si le compte utilisateur est un compte de demo, ceci pour mettre + le display ranking aux max de 50 + """ + + coll_partner_account = MYSY_GV.dbname['partnair_account'] + myquery = {"recid": str(diction['partnaire_recid']), "active": "1", + "demo_account": "1"} + + print(" myquery pr demo_account = "+str(myquery)) + tmp = coll_partner_account.count_documents(myquery) + + if (tmp > 0): + new_ranking_value = MYSY_GV.DEMO_RANKING_VALUE + print(" myquery pr demo_account 222 = " + str(tmp)) + coll_class = MYSY_GV.dbname['myclass'] now = datetime.now() update_data = {"display_rank":str(new_ranking_value), "date_update":str(now)} + if( tmp > 0 ): + update_data['isalaune'] = "1" ret_val = coll_class.update_many( {"partner_owner_recid": str(diction['partnaire_recid']), "valide":"1"}, diff --git a/prj_common.py b/prj_common.py index 64fd990..c49fffb 100644 --- a/prj_common.py +++ b/prj_common.py @@ -1951,15 +1951,15 @@ def Partner_Get_pack_nbTraining(partner_recid): coll_partner = MYSY_GV.dbname['partnair_account'] tmp = coll_partner.find({'recid':str(partner_recid)}) - print("tmp = " + str(tmp[0])) + #print("tmp = " + str(tmp[0])) if(tmp and tmp[0] ): partner_pack = tmp[0]['pack_service'] partner_pack = str(partner_pack).lower() - print(" partner_pack = "+partner_pack) + #print(" partner_pack = "+partner_pack) coll_pack = MYSY_GV.dbname['pack'] tmp_pack = coll_pack.find({'code_pack':str(partner_pack)}) - print("tmp_pack = "+str(tmp_pack[0])) + #print("tmp_pack = "+str(tmp_pack[0])) if( tmp_pack and tmp_pack[0]): partner_pack_nb_formation = tmp_pack[0]['nb_formation'] else: