22/07/2024 - 21h
parent
abd8f3b7bb
commit
8cfc3c0c0e
|
@ -1,13 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="17/07/2024 - 11h30sdf">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="21/07/2024 - 12h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_user_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_user_account.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -77,13 +79,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00307" summary="20/05/2024 - 14h00">
|
||||
<created>1716206194944</created>
|
||||
<option name="number" value="00307" />
|
||||
<option name="presentableId" value="LOCAL-00307" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1716206194944</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00308" summary="20/05/2024 - 22h00">
|
||||
<created>1716233337268</created>
|
||||
<option name="number" value="00308" />
|
||||
|
@ -420,7 +415,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1721461819239</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="356" />
|
||||
<task id="LOCAL-00356" summary="21/07/2024 - 12h">
|
||||
<created>1721557111552</created>
|
||||
<option name="number" value="00356" />
|
||||
<option name="presentableId" value="LOCAL-00356" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1721557111553</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="357" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -462,7 +464,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="ssq" />
|
||||
<MESSAGE value="qqsd" />
|
||||
<MESSAGE value="11/06/2024 - 23h30" />
|
||||
<MESSAGE value="12/06/2024 - 21h30" />
|
||||
|
@ -487,6 +488,7 @@
|
|||
<MESSAGE value="dqsdqss" />
|
||||
<MESSAGE value="17/07/2024 - 11h30" />
|
||||
<MESSAGE value="17/07/2024 - 11h30sdf" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="17/07/2024 - 11h30sdf" />
|
||||
<MESSAGE value="21/07/2024 - 12h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="21/07/2024 - 12h" />
|
||||
</component>
|
||||
</project>
|
|
@ -632,6 +632,14 @@ Ici on definit la périodicité
|
|||
"""
|
||||
PURCHASE_PRICE_PERIODICITY = ['fixe', 'heure', 'jour', 'mois', 'annee', ]
|
||||
|
||||
|
||||
"""
|
||||
Recyclage des formation
|
||||
Ici on definit la périodicité
|
||||
"""
|
||||
RECYCLAGE_PERIODICITY = [ 'mois', 'annee', ]
|
||||
|
||||
|
||||
"""
|
||||
Les civilité
|
||||
"""
|
||||
|
|
|
@ -12,6 +12,7 @@ from email.mime.multipart import MIMEMultipart
|
|||
from email.mime.text import MIMEText
|
||||
import ast
|
||||
import pymongo
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from pymongo import MongoClient
|
||||
import json
|
||||
from bson import ObjectId
|
||||
|
@ -7356,7 +7357,8 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
'foreignField': 'internal_url',
|
||||
'pipeline': [{'$match':{ '$and' : [ filt_class_title, filt_class_partner_recid] } }, {'$project': {'title': 1, 'domaine': 1,
|
||||
'duration': 1,
|
||||
'duration_unit': 1, '_id':1}}],
|
||||
'duration_unit': 1, '_id':1,
|
||||
'recyclage_delai':1, 'recyclage_periodicite':1}}],
|
||||
'as': 'myclass_collection'
|
||||
}
|
||||
},
|
||||
|
@ -7463,6 +7465,7 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
else:
|
||||
val['domaine'] = ""
|
||||
|
||||
|
||||
# Recuperation des informations de la session
|
||||
local_qry = {'_id':ObjectId(retVal['session_id']), 'valide':'1'}
|
||||
|
||||
|
@ -7583,6 +7586,46 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
else:
|
||||
val['session_ondemande'] = "0"
|
||||
|
||||
"""
|
||||
Gestion du recyclage d'un apprenant si la formation a laquelle il a participer
|
||||
necessite un recyclage.
|
||||
On ne fait ce controle que sur l'inscription 'recyclage_managed' != "1" ou est
|
||||
"""
|
||||
val['class_recyclage_delai'] = ""
|
||||
val['class_recyclage_periodicite'] = ""
|
||||
val['nb_jour_avant_recyclage'] = ""
|
||||
|
||||
if( "recyclage_managed" not in retVal.keys() or retVal['recyclage_managed'] != "1"):
|
||||
|
||||
|
||||
if ("recyclage_delai" in retVal['myclass_collection'][0].keys()):
|
||||
val['class_recyclage_delai'] = retVal['myclass_collection'][0]['recyclage_delai']
|
||||
|
||||
|
||||
if ("recyclage_periodicite" in retVal['myclass_collection'][0].keys()):
|
||||
val['class_recyclage_periodicite'] = retVal['myclass_collection'][0]['recyclage_periodicite']
|
||||
|
||||
|
||||
|
||||
if (str(val['class_recyclage_delai']) != "" and str(val['class_recyclage_periodicite']) != ""):
|
||||
session_date_debut = str(session_retval['date_debut'])[0:10]
|
||||
session_date_debut_datetime = datetime.strptime(str(session_date_debut).strip(), '%d/%m/%Y')
|
||||
if (str(val['class_recyclage_periodicite']) == "mois"):
|
||||
class_recyclage_delai_int = mycommon.tryInt(str(val['class_recyclage_delai']))
|
||||
session_date_debut_datetime = session_date_debut_datetime + relativedelta( months=+class_recyclage_delai_int)
|
||||
|
||||
elif (str(val['class_recyclage_periodicite']) == "annee"):
|
||||
class_recyclage_delai_int = mycommon.tryInt(str(val['class_recyclage_delai']))
|
||||
session_date_debut_datetime = session_date_debut_datetime + relativedelta( years=+class_recyclage_delai_int)
|
||||
|
||||
mytoday = datetime.today().strftime("%d/%m/%Y")
|
||||
mytoday_datetime = datetime.strptime(str(mytoday).strip(), '%d/%m/%Y')
|
||||
|
||||
local_delta = session_date_debut_datetime - mytoday_datetime
|
||||
val['nb_jour_avant_recyclage'] = str(local_delta.days)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
/!\ : 28/12/2023 - update
|
||||
S'il y a de la data dans la collection 'apprenant_collection' cela veut dire qu'il y a un dossier apprenant,
|
||||
|
@ -7684,9 +7727,89 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
|
||||
|
||||
|
||||
"""
|
||||
Gestion du recyclage :
|
||||
Cette fonction permet d'acquiter la gestion du recyclage d'une inscription
|
||||
Ex : l'inscrit ne souhaite plus le repasser, donc on met 'recyclage_managed' à '0'
|
||||
ou le cas la personne s'est bien reinscrite, donc plus besoin de traiter les donnees de recyclage
|
||||
|
||||
"""
|
||||
def Inscription_Recyclage_Management_Done(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
field_list_obligatoire = ['token', 'tab_inscriptions_ids']
|
||||
|
||||
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, " La valeur '" + val + "' n'est pas presente dans liste"
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
tab_inscriptions_ids = ""
|
||||
if ("tab_inscriptions_ids" in diction.keys()):
|
||||
if diction['tab_inscriptions_ids']:
|
||||
tab_inscriptions_ids = diction['tab_inscriptions_ids']
|
||||
|
||||
tab_inscriptions_ids_splited = str(tab_inscriptions_ids).split(",")
|
||||
|
||||
tab_inscriptions_ids_splited_obj = []
|
||||
for tmp in tab_inscriptions_ids_splited :
|
||||
tab_inscriptions_ids_splited_obj.append(ObjectId(str(tmp)))
|
||||
|
||||
print(" ### tab_inscriptions_ids_splited_obj = ", tab_inscriptions_ids_splited_obj)
|
||||
|
||||
"""
|
||||
Verifier que les inscriptions sont valides
|
||||
"""
|
||||
for inscription in tab_inscriptions_ids_splited_obj:
|
||||
print({'_id':inscription, 'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
is_valide_inscription_count = MYSY_GV.dbname['inscription'].count_documents({'_id':inscription, 'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_inscription_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'inscription "+str(inscription)+" est invalide ")
|
||||
return False, " L'identifiant de l'inscription "+str(inscription)+" est invalide "
|
||||
|
||||
|
||||
|
||||
for inscription in tab_inscriptions_ids_splited_obj:
|
||||
new_data = {}
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
new_data['recyclage_managed'] = "1"
|
||||
|
||||
ret_val = MYSY_GV.dbname['inscription'].find_one_and_update(
|
||||
{'_id': inscription, 'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])},
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
|
||||
|
||||
return True, " La mise à jour à été correctement faite "
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de faire la mise à jour "
|
||||
|
||||
"""
|
||||
Cette fonction prend '_id' d'une ligne et retour les information de l'inscription associé.
|
||||
|
||||
|
|
2335
Log/log_file.log
2335
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -622,7 +622,7 @@ def GetSessionFormation(diction):
|
|||
'from': 'myclass',
|
||||
'localField': 'class_internal_url',
|
||||
'foreignField': 'internal_url',
|
||||
'pipeline': [{'$project': {'title': 1, 'lms_class_code':1, 'external_code':1, 'published':1}}],
|
||||
'pipeline': [{'$project': {'title': 1, 'lms_class_code':1, 'external_code':1, 'published':1, 'recyclage_delai':1, 'recyclage_periodicite':1}}],
|
||||
'as': 'myclass'
|
||||
}
|
||||
}
|
||||
|
@ -810,7 +810,7 @@ def Get_Given_SessionFormation_From_Id(diction):
|
|||
'from': 'myclass',
|
||||
'localField': 'class_internal_url',
|
||||
'foreignField': 'internal_url',
|
||||
'pipeline': [{'$project': {'title': 1, 'lms_class_code':1, 'external_code':1, 'published':1}}],
|
||||
'pipeline': [{'$project': {'title': 1, 'lms_class_code':1, 'external_code':1, 'published':1, 'recyclage_delai':1, 'recyclage_periodicite':1}}],
|
||||
'as': 'myclass'
|
||||
}
|
||||
}
|
||||
|
@ -1257,7 +1257,8 @@ def GetAllValideSessionPartner_List(diction):
|
|||
'localField': 'class_internal_url',
|
||||
'foreignField':'internal_url',
|
||||
'pipeline': [{'$match': filt_class_partner_recid}, {'$project': {'title': 1, 'domaine': 1,
|
||||
'duration': 1, 'duration_unit': 1, 'external_code':1, 'published':1}}],
|
||||
'duration': 1, 'duration_unit': 1, 'external_code':1,
|
||||
'published':1, 'recyclage_delai':1, 'recyclage_periodicite':1}}],
|
||||
'as': 'myclass_collection'
|
||||
}
|
||||
}
|
||||
|
@ -1592,7 +1593,7 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
'localField': 'class_internal_url',
|
||||
'foreignField': 'internal_url',
|
||||
'pipeline': [{'$match': { '$and' : [ filt_class_title,filt_class_external_code, {'partner_owner_recid':str(my_partner['recid'])} ]} }, {'$project': {'title': 1, 'domaine':1,
|
||||
'duration':1, 'duration_unit':1, 'external_code':1}}],
|
||||
'duration':1, 'duration_unit':1, 'external_code':1, 'recyclage_delai':1, 'recyclage_periodicite':1}}],
|
||||
'as': 'myclass_collection'
|
||||
}
|
||||
}
|
||||
|
@ -1926,7 +1927,7 @@ def GetAllValideSessionPartner_List_no_filter(diction):
|
|||
'foreignField': 'internal_url',
|
||||
'pipeline': [{'$match': {'partner_owner_recid': str(my_partner['recid'])} },
|
||||
{'$project': {'title': 1, 'domaine': 1,
|
||||
'duration': 1, 'duration_unit': 1, 'external_code':1}}],
|
||||
'duration': 1, 'duration_unit': 1, 'external_code':1, 'recyclage_delai':1, 'recyclage_periodicite':1}}],
|
||||
'as': 'myclass_collection'
|
||||
}
|
||||
}
|
||||
|
@ -4393,7 +4394,7 @@ def Is_Corresponding_SessionFormation(diction):
|
|||
'from': 'myclass',
|
||||
'localField': 'class_internal_url',
|
||||
'foreignField': 'internal_url',
|
||||
'pipeline': [{'$project': {'title': 1, 'lms_class_code':1}}],
|
||||
'pipeline': [{'$project': {'title': 1, 'lms_class_code':1, 'recyclage_delai':1, 'recyclage_periodicite':1}}],
|
||||
'as': 'myclass'
|
||||
}
|
||||
}
|
||||
|
@ -11498,7 +11499,7 @@ def Invoice_Create_Secure_E_Document(diction):
|
|||
{'$project': {'title': 1, 'domaine': 1,
|
||||
'duration': 1,
|
||||
'duration_unit': 1,
|
||||
'external_code': 1}}],
|
||||
'external_code': 1,'recyclage_delai':1, 'recyclage_periodicite':1}}],
|
||||
'as': 'myclass_collection'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import ast
|
|||
import xlsxwriter
|
||||
import jinja2
|
||||
import pymongo
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from flask import send_file
|
||||
from pymongo import MongoClient
|
||||
import json
|
||||
|
@ -1224,7 +1225,9 @@ def Get_Apprenant_List_Inscription(diction):
|
|||
'partner_owner_recid':str(my_partner['recid']),
|
||||
}, {"_id":1, "class_internal_url":1,"session_id":1, 'status':1,
|
||||
"inscription_validation_date":1, "modefinancement":1, "inscription_refuse_date":1,
|
||||
'client_rattachement_id':1}):
|
||||
'client_rattachement_id':1, 'recyclage_managed':1}):
|
||||
|
||||
|
||||
user = val
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
@ -1249,12 +1252,12 @@ def Get_Apprenant_List_Inscription(diction):
|
|||
if( local_status is False ):
|
||||
return local_status, local_retval
|
||||
|
||||
|
||||
local_retval = ast.literal_eval(local_retval_str[0])
|
||||
|
||||
if( local_retval and "title" in local_retval.keys()):
|
||||
user['class_title'] = local_retval['title']
|
||||
|
||||
|
||||
if (local_retval and "formateur_nom_prenom" in local_retval.keys()):
|
||||
user['formateur_nom_prenom'] = local_retval['formateur_nom_prenom']
|
||||
|
||||
|
@ -1285,6 +1288,46 @@ def Get_Apprenant_List_Inscription(diction):
|
|||
if (local_retval and "code_session" in local_retval.keys()):
|
||||
user['code_session'] = local_retval['code_session']
|
||||
|
||||
"""
|
||||
Gestion du recyclage d'un apprenant si la formation a laquelle il a participer
|
||||
necessite un recyclage
|
||||
On ne fait ce controle que sur l'inscription 'recyclage_managed' != "1" ou est
|
||||
"""
|
||||
user['class_recyclage_delai'] = ""
|
||||
user['class_recyclage_periodicite'] = ""
|
||||
user['nb_jour_avant_recyclage'] = ""
|
||||
|
||||
|
||||
if ("recyclage_managed" not in val.keys() or val['recyclage_managed'] != "1"):
|
||||
|
||||
if (local_retval and "myclass" in local_retval.keys() and "recyclage_delai" in local_retval['myclass'][0].keys()):
|
||||
user['class_recyclage_delai'] = local_retval['myclass'][0]['recyclage_delai']
|
||||
|
||||
|
||||
|
||||
if (local_retval and "myclass" in local_retval.keys() and "recyclage_periodicite" in local_retval['myclass'][0].keys()):
|
||||
user['class_recyclage_periodicite'] = local_retval['myclass'][0]['recyclage_periodicite']
|
||||
|
||||
|
||||
if( str(user['class_recyclage_delai']) != "" and str(user['class_recyclage_periodicite']) != ""):
|
||||
session_date_debut = str(local_retval['date_debut'])
|
||||
session_date_debut_datetime = datetime.strptime(str(session_date_debut).strip(), '%d/%m/%Y')
|
||||
if( str(user['class_recyclage_periodicite']) == "mois"):
|
||||
class_recyclage_delai_int = mycommon.tryInt(str(user['class_recyclage_delai'] ))
|
||||
session_date_debut_datetime = session_date_debut_datetime + relativedelta(months=+class_recyclage_delai_int)
|
||||
|
||||
elif (str(user['class_recyclage_periodicite']) == "annee"):
|
||||
class_recyclage_delai_int = mycommon.tryInt(str(user['class_recyclage_delai']))
|
||||
session_date_debut_datetime = session_date_debut_datetime + relativedelta(years=+class_recyclage_delai_int)
|
||||
|
||||
|
||||
mytoday = datetime.today().strftime("%d/%m/%Y")
|
||||
mytoday_datetime = datetime.strptime(str(mytoday).strip(), '%d/%m/%Y')
|
||||
|
||||
local_delta = session_date_debut_datetime - mytoday_datetime
|
||||
user['nb_jour_avant_recyclage'] = str(local_delta.days)
|
||||
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
|
181
class_mgt.py
181
class_mgt.py
|
@ -46,6 +46,7 @@ application tiers car on est sur des API.
|
|||
|
||||
def add_class(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
'''
|
||||
# Verification que les champs reçus dans l'API sont bien dans la liste des champs autorisés
|
||||
# Cela evite le cas ou une entité tierce ajouter les valeurs inconnu dans l'API
|
||||
|
@ -58,7 +59,7 @@ def add_class(diction):
|
|||
'programme', 'prerequis', 'note', 'cpf', 'certif', 'class_inscription_url', 'pourqui',
|
||||
'support', 'img_banner_detail_class', 'source', 'lms_class_code', 'formateur_id',
|
||||
'class_level', 'methode_pedagogique', 'condition_handicape', 'suivi_eval', 'class_id',
|
||||
'version', 'categorie']
|
||||
'version', 'categorie', 'recyclage_delai', 'recyclage_periodicite']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -217,6 +218,33 @@ def add_class(diction):
|
|||
cpf = diction['cpf']
|
||||
mydata['cpf'] = diction['cpf']
|
||||
|
||||
recyclage_delai = ""
|
||||
if ("recyclage_delai" in diction.keys()):
|
||||
if diction['recyclage_delai']:
|
||||
recyclage_delai = diction['recyclage_delai']
|
||||
local_status, local_retval = mycommon.IsInt(str(recyclage_delai))
|
||||
if( local_status is False ):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " Le delai de recyclage n'est pas valide ")
|
||||
return False, " Le delai de recyclage n'est pas valide ", False
|
||||
recyclage_delai = local_retval
|
||||
|
||||
mydata['recyclage_delai'] = str(recyclage_delai)
|
||||
|
||||
recyclage_periodicite = ""
|
||||
if ("recyclage_periodicite" in diction.keys()):
|
||||
if diction['recyclage_periodicite']:
|
||||
recyclage_periodicite = diction['recyclage_periodicite']
|
||||
if( recyclage_periodicite not in MYSY_GV.RECYCLAGE_PERIODICITY):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " La périodicité du recyclage n'est pas valide ")
|
||||
return False, " La périodicité du recyclage n'est pas valide ", False
|
||||
recyclage_periodicite = recyclage_periodicite
|
||||
|
||||
mydata['recyclage_periodicite'] = str(recyclage_periodicite)
|
||||
|
||||
|
||||
class_level = "0"
|
||||
if ("class_level" in diction.keys()):
|
||||
|
@ -712,7 +740,8 @@ def update_class(diction):
|
|||
'published', 'img_url', 'objectif', 'programme', 'prerequis', 'note',
|
||||
'cpf', 'certif', 'class_inscription_url','pourqui', 'support', 'img_banner_detail_class',
|
||||
'duration_unit', 'source', 'lms_class_code', 'formateur_id', 'class_level','methode_pedagogique',
|
||||
'condition_handicape', 'suivi_eval', 'class_id', 'version', 'categorie']
|
||||
'condition_handicape', 'suivi_eval', 'class_id', 'version', 'categorie', 'recyclage_delai',
|
||||
'recyclage_periodicite']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -789,6 +818,36 @@ def update_class(diction):
|
|||
mydata['class_level'] = diction['class_level']
|
||||
|
||||
|
||||
if ("recyclage_delai" in diction.keys()):
|
||||
recyclage_delai = ""
|
||||
if diction['recyclage_delai']:
|
||||
recyclage_delai = diction['recyclage_delai']
|
||||
local_status, local_retval = mycommon.IsInt(str(recyclage_delai))
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " Le delai de recyclage n'est pas valide ")
|
||||
return False, " Le delai de recyclage n'est pas valide ", False
|
||||
recyclage_delai = local_retval
|
||||
|
||||
mydata['recyclage_delai'] = str(recyclage_delai)
|
||||
|
||||
|
||||
if ("recyclage_periodicite" in diction.keys()):
|
||||
recyclage_periodicite = ""
|
||||
if diction['recyclage_periodicite']:
|
||||
recyclage_periodicite = diction['recyclage_periodicite']
|
||||
if (recyclage_periodicite not in MYSY_GV.RECYCLAGE_PERIODICITY):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " La périodicité du recyclage n'est pas valide ")
|
||||
return False, " La périodicité du recyclage n'est pas valide ", False
|
||||
recyclage_periodicite = recyclage_periodicite
|
||||
|
||||
mydata['recyclage_periodicite'] = str(recyclage_periodicite)
|
||||
|
||||
|
||||
|
||||
source = ""
|
||||
if ("source" in diction.keys()):
|
||||
mydata['source'] = diction['source']
|
||||
|
@ -2038,7 +2097,7 @@ def get_class(diction):
|
|||
).limit(1):
|
||||
"""
|
||||
|
||||
print('#### ICI retVal = '+str(retVal))
|
||||
#print('#### ICI retVal = '+str(retVal))
|
||||
if ("business_prices" in retVal.keys()):
|
||||
|
||||
if(len(retVal['business_prices']) > 0 and "discount" in retVal['business_prices'][0].keys() ):
|
||||
|
@ -2211,6 +2270,14 @@ def get_class(diction):
|
|||
#print(" #### Pour la formation :",internal_url, " text_size = ", str(text_size))
|
||||
#mycommon.myprint(" #### "+str(retVal))
|
||||
user = retVal
|
||||
|
||||
if( "recyclage_delai" not in user.keys()):
|
||||
user['recyclage_delai'] = ""
|
||||
|
||||
if ("recyclage_periodicite" not in user.keys()):
|
||||
user['recyclage_periodicite'] = ""
|
||||
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
@ -2314,6 +2381,13 @@ def get_class_coup_de_coeur(diction):
|
|||
|
||||
#mycommon.myprint(str(retVal))
|
||||
user = retVal
|
||||
|
||||
if ("recyclage_delai" not in user.keys()):
|
||||
user['recyclage_delai'] = ""
|
||||
|
||||
if ("recyclage_periodicite" not in user.keys()):
|
||||
user['recyclage_periodicite'] = ""
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
@ -2528,6 +2602,14 @@ def get_partner_class(diction):
|
|||
if ("lms_class_code" not in retVal.keys()):
|
||||
retVal['lms_class_code'] = "0"
|
||||
|
||||
if ("recyclage_delai" not in retVal.keys()):
|
||||
retVal['recyclage_delai'] = ""
|
||||
|
||||
|
||||
if ("recyclage_periodicite" not in retVal.keys()):
|
||||
retVal['recyclage_periodicite'] = ""
|
||||
|
||||
|
||||
# Recuperation des données du formateur
|
||||
formateur_nom_prenom = ""
|
||||
# Si il y a un code formateur_id, alors on va recuperer les nom et prenom du formation
|
||||
|
@ -2802,6 +2884,14 @@ def find_partner_class_like(diction):
|
|||
if ("lms_class_code" not in retVal.keys()):
|
||||
retVal['lms_class_code'] = "0"
|
||||
|
||||
if ("recyclage_delai" not in retVal.keys()):
|
||||
retVal['recyclage_delai'] = ""
|
||||
|
||||
|
||||
if ("recyclage_periodicite" not in retVal.keys()):
|
||||
retVal['recyclage_periodicite'] = ""
|
||||
|
||||
|
||||
# Recuperer le nombre de session pour cette formation
|
||||
nb_session_formation_count = MYSY_GV.dbname['session_formation'].count_documents(
|
||||
{'class_internal_url': str(retVal['internal_url']),
|
||||
|
@ -3056,6 +3146,13 @@ def get_partner_class_external_code(diction):
|
|||
).sort([("external_code",pymongo.ASCENDING),]).sort([("_id", pymongo.DESCENDING), ]):
|
||||
# mycommon.myprint(str(retVal))
|
||||
user = retVal
|
||||
|
||||
if ("recyclage_delai" not in user.keys()):
|
||||
user['recyclage_delai'] = ""
|
||||
|
||||
if ("recyclage_periodicite" not in user.keys()):
|
||||
user['recyclage_periodicite'] = ""
|
||||
|
||||
user['id'] = str(val_tmp)
|
||||
|
||||
'''
|
||||
|
@ -3209,7 +3306,7 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
|||
'mots_cle', 'zone_diffusion', 'metier', 'publie', 'img_url',
|
||||
'objectif', 'programme', 'prerequis', 'formateur', 'note', 'cpf', 'certif',
|
||||
'class_inscription_url', 'pourqui', 'support', 'img_banner_detail_class', 'formateur_email',
|
||||
'methode_pedagogique', 'condition_handicape', 'suivi_eval', 'version', 'categorie']
|
||||
'methode_pedagogique', 'condition_handicape', 'suivi_eval', 'version', 'categorie', 'recyclage_delai', 'recyclage_periodicite']
|
||||
|
||||
total_rows = len(df)
|
||||
|
||||
|
@ -3375,6 +3472,33 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
|||
price = str(df['prix'].values[n]).strip()
|
||||
mydata['price'] = price
|
||||
|
||||
recyclage_delai = ""
|
||||
if ("recyclage_delai" in diction.keys()):
|
||||
if diction['recyclage_delai']:
|
||||
recyclage_delai = diction['recyclage_delai']
|
||||
local_status, local_retval = mycommon.IsInt(str(recyclage_delai))
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " Le delai de recyclage n'est pas valide ")
|
||||
return False, " Le delai de recyclage n'est pas valide "
|
||||
recyclage_delai = local_retval
|
||||
|
||||
mydata['recyclage_delai'] = str(recyclage_delai)
|
||||
|
||||
recyclage_periodicite = ""
|
||||
if ("recyclage_periodicite" in diction.keys()):
|
||||
if diction['recyclage_periodicite']:
|
||||
recyclage_periodicite = diction['recyclage_periodicite']
|
||||
if (recyclage_periodicite not in MYSY_GV.RECYCLAGE_PERIODICITY):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " La périodicité du recyclage n'est pas valide ")
|
||||
return False, " La périodicité du recyclage n'est pas valide "
|
||||
recyclage_periodicite = recyclage_periodicite
|
||||
|
||||
mydata['recyclage_periodicite'] = str(recyclage_periodicite)
|
||||
|
||||
|
||||
metier_id = ""
|
||||
if ("metier" in df.keys()):
|
||||
|
@ -3700,7 +3824,7 @@ def Controle_add_class_mass(saved_file=None, Folder=None, diction=None):
|
|||
'mots_cle', 'zone_diffusion', 'metier', 'publie', 'img_url',
|
||||
'objectif', 'programme', 'prerequis', 'formateur', 'note', 'cpf', 'certif',
|
||||
'class_inscription_url', 'pourqui', 'support', 'img_banner_detail_class', 'formateur_email' ,'methode_pedagogique',
|
||||
'condition_handicape', 'suivi_eval', 'version', 'categorie']
|
||||
'condition_handicape', 'suivi_eval', 'version', 'categorie', 'recyclage_delai', 'recyclage_periodicite']
|
||||
|
||||
total_rows = len(df)
|
||||
|
||||
|
@ -3803,7 +3927,7 @@ def Controle_add_class_mass(saved_file=None, Folder=None, diction=None):
|
|||
"""
|
||||
Verifier que le domaine est bien dans la liste acceptée
|
||||
"""
|
||||
print(" domaine a tester = ", str(mydata['domaine']).strip())
|
||||
#print(" domaine a tester = ", str(mydata['domaine']).strip())
|
||||
count_domaine = MYSY_GV.dbname['class_domaine'].count_documents(
|
||||
{'code': str(mydata['domaine']).strip(), 'valide': '1', 'locked': '0',
|
||||
})
|
||||
|
@ -3850,7 +3974,34 @@ def Controle_add_class_mass(saved_file=None, Folder=None, diction=None):
|
|||
|
||||
mydata['categorie'] = categorie
|
||||
|
||||
recyclage_delai = ""
|
||||
if ("recyclage_delai" in diction.keys()):
|
||||
if diction['recyclage_delai']:
|
||||
recyclage_delai = diction['recyclage_delai']
|
||||
local_status, local_retval = mycommon.IsInt(str(recyclage_delai))
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " Le delai de recyclage n'est pas valide pour la formation à la ligne " + str(n+2) + " .")
|
||||
return False, " Le delai de recyclage n'est pas valide pour la formation à la ligne " + str(n+2) + " ."
|
||||
recyclage_delai = local_retval
|
||||
|
||||
mydata['recyclage_delai'] = str(recyclage_delai)
|
||||
|
||||
recyclage_periodicite = ""
|
||||
if ("recyclage_periodicite" in diction.keys()):
|
||||
if diction['recyclage_periodicite']:
|
||||
recyclage_periodicite = diction['recyclage_periodicite']
|
||||
if (recyclage_periodicite not in MYSY_GV.RECYCLAGE_PERIODICITY):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " La périodicité du recyclage n'est pas valide pour la formation à la ligne " + str(n+2) + " .")
|
||||
return False, "La périodicité du recyclage n'est pas valide pour la formation à la ligne " + str(n+2) + " ."
|
||||
recyclage_periodicite = recyclage_periodicite
|
||||
|
||||
mydata['recyclage_periodicite'] = str(recyclage_periodicite)
|
||||
|
||||
|
||||
# Verifier que l'adresse email du formateur est valide
|
||||
formateur_email = ""
|
||||
formateur_id = ""
|
||||
|
@ -4225,6 +4376,12 @@ def get_class_by_metier(diction):
|
|||
|
||||
# mycommon.myprint(str(retVal))
|
||||
user = retVal
|
||||
if ("recyclage_delai" not in user.keys()):
|
||||
user['recyclage_delai'] = ""
|
||||
|
||||
if ("recyclage_periodicite" not in user.keys()):
|
||||
user['recyclage_periodicite'] = ""
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
# print(" 22222 ")
|
||||
retVal_for_stat = retVal
|
||||
|
@ -4959,6 +5116,11 @@ def get_Class_From_Internal_Url(diction):
|
|||
'partner_owner_recid':str(my_partner['recid'])}):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
if ("recyclage_delai" not in user.keys()):
|
||||
user['recyclage_delai'] = ""
|
||||
|
||||
if ("recyclage_periodicite" not in user.keys()):
|
||||
user['recyclage_periodicite'] = ""
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
@ -5022,6 +5184,11 @@ def get_Class_From_Url(diction):
|
|||
val_tmp = 1
|
||||
for retval in MYSY_GV.dbname['myclass'].find({'valide': '1', 'locked': '0', 'url':str(diction['url']), }):
|
||||
user = retval
|
||||
if ("recyclage_delai" not in user.keys()):
|
||||
user['recyclage_delai'] = ""
|
||||
|
||||
if ("recyclage_periodicite" not in user.keys()):
|
||||
user['recyclage_periodicite'] = ""
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
@ -5121,11 +5288,13 @@ def Duplicate_Class(diction):
|
|||
new_external_code = str(class_to_duplicate['external_code']) + "_dup_" + str(suffix[0:1])
|
||||
|
||||
|
||||
"""
|
||||
print(" FINAL DUPLICATE DATA = ")
|
||||
print(" ### new_title = ", new_title)
|
||||
print(" ### new_internal_code = ", new_internal_code)
|
||||
print(" ### new_internal_url = ", new_internal_url)
|
||||
print(" ### new_external_code = ", new_external_code)
|
||||
"""
|
||||
|
||||
|
||||
new_class = class_to_duplicate
|
||||
|
|
16
main.py
16
main.py
|
@ -4653,6 +4653,22 @@ def GetAttendeeDetail_perSession_from_line_id():
|
|||
status, retval = inscription.GetAttendeeDetail_perSession_from_line_id(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API permet d'acquiter la gestion du recyclage d'une inscription
|
||||
"""
|
||||
@app.route('/myclass/api/Inscription_Recyclage_Management_Done/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Inscription_Recyclage_Management_Done():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Inscription_Recyclage_Management_Done payload = ",payload)
|
||||
status, retval = inscription.Inscription_Recyclage_Management_Done(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API qui met à jour le tuteur
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue