25/09/22 - 15h00
parent
501a34e0c1
commit
0c0ebc0083
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (venv)" project-jdk-type="Python SDK" />
|
||||
<component name="PyCharmProfessionalAdvertiser">
|
||||
<option name="shown" value="true" />
|
||||
</component>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.9" jdkType="Python SDK" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.10 (venv)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
71
class_mgt.py
71
class_mgt.py
|
@ -2209,4 +2209,73 @@ def get_class_by_metier(diction):
|
|||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de recuperer les formations par metier"
|
||||
return False, "Impossible de recuperer les formations par metier"
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
def UpdataPartnerRankingClass(diction):
|
||||
try:
|
||||
|
||||
'''
|
||||
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||
On controle que les champs obligatoires sont presents dans la liste
|
||||
'''
|
||||
field_list_obligatoire = ['partnaire_recid', 'new_pack_name']
|
||||
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
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 = ""
|
||||
coll_pack = MYSY_GV.dbname["pack"]
|
||||
tmp = coll_pack.count_documents({"code_pack":str(diction["new_pack_name"]).lower()})
|
||||
|
||||
if( tmp <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - le pack "+str(diction["new_pack_name"]).lower()+ " n'est pas paramettré corretement")
|
||||
return False, "Impossible de mettre à jour le rang des formations"
|
||||
|
||||
ranking_tab = None
|
||||
|
||||
ranking_tab = coll_pack.find({"code_pack":str(diction["new_pack_name"]).lower()})
|
||||
|
||||
|
||||
if( ranking_tab and ranking_tab[0] and ranking_tab[0]["ranking"] ):
|
||||
new_ranking_value = str(ranking_tab[0]["ranking"])
|
||||
else:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - le pack " + str(
|
||||
diction["new_pack_name"]) + " n'est pas paramettré corretement - V2")
|
||||
return False, "Impossible de mettre à jour le rang des formations"
|
||||
|
||||
|
||||
coll_class = MYSY_GV.dbname['myclass']
|
||||
|
||||
now = datetime.now()
|
||||
update_data = {"display_rank":str(new_ranking_value), "date_update":str(now)}
|
||||
|
||||
ret_val = coll_class.update_many(
|
||||
{"partner_owner_recid": str(diction['partnaire_recid']), "valide":"1"},
|
||||
{"$set": update_data}, )
|
||||
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - Le RANKING de "+str(ret_val.matched_count)+" ont été mise à jour avec la valeur "+str(update_data))
|
||||
|
||||
|
||||
return True, " Mise à jour du display_rank OK"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de mettre à jour le rang des formations"
|
|
@ -26,6 +26,7 @@ import ftplib
|
|||
import pysftp
|
||||
from flask import send_file
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import class_mgt as class_mgt
|
||||
|
||||
|
||||
class JSONEncoder(json.JSONEncoder):
|
||||
|
@ -245,6 +246,24 @@ def add_payement_mode(diction):
|
|||
|
||||
print("mode de payement data :"+str(new_data))
|
||||
|
||||
print("str(new_data['num_carte']) = "+str(new_data['num_carte']) )
|
||||
print("str(new_data['nom_carte']) = " + str(new_data['nom_carte']) )
|
||||
|
||||
"""if( str(new_data['type']) == "cb"):
|
||||
if( len(str(new_data['num_carte'])) <= 0 or len(str(new_data['nom_carte'])) ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " : Les données de la carte sont incorrectes")
|
||||
return False, "Impossible d'ajouter le mode de paiement. Les données de la carte sont incorrectes"
|
||||
|
||||
if (str(new_data['type']) == "sepa"):
|
||||
if (len(str(new_data['iban'])) <= 0 or len(str(new_data['bic']))
|
||||
or len(str(new_data['nom_compte'])) ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " : Les données bancaires sont incorrectes")
|
||||
return False, "Impossible d'ajouter le mode de paiement. Les données bancaires sont incorrectes"
|
||||
"""
|
||||
|
||||
|
||||
ret_val = coll_name.find_one_and_update(
|
||||
{'client_recid': user_recid, 'valide': '1'},
|
||||
{"$set": new_data},
|
||||
|
@ -604,6 +623,10 @@ def createOrder(diction):
|
|||
if (total_ttc_float > 0):
|
||||
CreateInvoice(new_data)
|
||||
|
||||
# Apres la facturation, on met à jour le display_ranking des formations du partenaire.
|
||||
tmp_diction = {"partnaire_recid":str(user_recid), "new_pack_na"
|
||||
"me":str(mypack)}
|
||||
class_mgt.UpdataPartnerRankingClass(tmp_diction)
|
||||
return True, "la commande été correctement créee", str(new_data['order_id'])
|
||||
else:
|
||||
mycommon.myprint(
|
||||
|
|
|
@ -2201,8 +2201,3 @@ def correction_collection():
|
|||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, False
|
||||
|
||||
|
||||
"""
|
||||
cherif
|
||||
"""
|
Loading…
Reference in New Issue