master
cherif 2024-05-27 13:10:03 +02:00
parent d080f8970a
commit 340b0cebae
4 changed files with 1978 additions and 13 deletions

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="gdfgdf"> <list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="26/05/2024 - 20h30">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.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$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -75,13 +75,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1680804787304</updated> <updated>1680804787304</updated>
</task> </task>
<task id="LOCAL-00265" summary="10/04/2024 - 22h50">
<created>1712781951218</created>
<option name="number" value="00265" />
<option name="presentableId" value="LOCAL-00265" />
<option name="project" value="LOCAL" />
<updated>1712781951219</updated>
</task>
<task id="LOCAL-00266" summary="11/04/2024 - 17h02"> <task id="LOCAL-00266" summary="11/04/2024 - 17h02">
<created>1712847771191</created> <created>1712847771191</created>
<option name="number" value="00266" /> <option name="number" value="00266" />
@ -418,7 +411,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1716732752644</updated> <updated>1716732752644</updated>
</task> </task>
<option name="localTasksCounter" value="314" /> <task id="LOCAL-00314" summary="26/05/2024 - 20h30">
<created>1716748087881</created>
<option name="number" value="00314" />
<option name="presentableId" value="LOCAL-00314" />
<option name="project" value="LOCAL" />
<updated>1716748087883</updated>
</task>
<option name="localTasksCounter" value="315" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -460,7 +460,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="06/05/2024 - 22h30" />
<MESSAGE value="07/05/2024 - 17h30" /> <MESSAGE value="07/05/2024 - 17h30" />
<MESSAGE value="08/05/2024 - 17h30" /> <MESSAGE value="08/05/2024 - 17h30" />
<MESSAGE value="08/05/2024 - 21h30" /> <MESSAGE value="08/05/2024 - 21h30" />
@ -485,6 +484,7 @@
<MESSAGE value="sdsqq" /> <MESSAGE value="sdsqq" />
<MESSAGE value="ss" /> <MESSAGE value="ss" />
<MESSAGE value="gdfgdf" /> <MESSAGE value="gdfgdf" />
<option name="LAST_COMMIT_MESSAGE" value="gdfgdf" /> <MESSAGE value="26/05/2024 - 20h30" />
<option name="LAST_COMMIT_MESSAGE" value="26/05/2024 - 20h30" />
</component> </component>
</project> </project>

View File

@ -5646,7 +5646,7 @@ def Init_AcceptAttendeeInscription_For_Initial_Formation(diction):
key_data['valide'] = "1" key_data['valide'] = "1"
key_data['partner_owner_recid'] = str(my_partner['recid']) key_data['partner_owner_recid'] = str(my_partner['recid'])
result = MYSY_GV.dbname['inscription_liste_ue'].find_one_and_update( result = MYSY_GV.dbname['inscription_liste_ue_type_evalution'].find_one_and_update(
key_data, key_data,
{"$set": new_data}, {"$set": new_data},
upsert=True, upsert=True,
@ -11580,3 +11580,231 @@ def Get_Accepted_Insription_From_Session_id_Reduice_Fields(diction):
exc_type, exc_obj, exc_tb = sys.exc_info() 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)) mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible de récupérer la liste des stagiaires de la formation" return False, "Impossible de récupérer la liste des stagiaires de la formation"
"""
Cette fonction retourne la liste des UE aux quelles un apprenant est inscrit
"""
def Get_Inscrit_List_EU(diction):
try:
"""
Verification de la liste des champs obligatoires
"""
field_list_obligatoire = ['token', 'inscription_id']
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, " Les informations fournies ne sont pas correctes"
mytoken = ""
if ("token" in diction.keys()):
if diction['token']:
mytoken = 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
formation_initiale = "0"
if ("formation_initiale" in my_partner.keys()):
formation_initiale = my_partner['formation_initiale']
if (formation_initiale != "1"):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Il ne s'agit pas d'un formation initiale ")
return True, " Il ne s'agit pas d'un formation initiale "
"""
Verifier que l'inscription est valide
"""
is_valide_inscription_count = MYSY_GV.dbname['inscription'].count_documents(
{'_id': ObjectId(diction['inscription_id']),
'partner_owner_recid': str(my_partner['recid']),
'valide': '1'})
if (is_valide_inscription_count != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant de l'inscrit est invalide ")
return False, " L'identifiant de l'inscrit est invalide "
RetObject = []
val_tmp = 0
qery_match = {'inscription_id': str(diction['inscription_id']), 'partner_owner_recid': str(my_partner['recid']), 'valide': '1',
'locked': '0'}
pipe_qry = ([
{'$match': qery_match},
{'$lookup': {
'from': 'unite_enseignement',
"let": {'class_eu_id': "$class_eu_id",
'partner_owner_recid': '$partner_owner_recid'},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$_id", {'$convert': {
'input': "$$class_eu_id",
'to': "objectId",
'onError': {'error': 'true'},
'onNull': {'isnull': 'true'}
}}]},
{'$eq': ["$valide", "1"]},
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']}
]
}
}
},
],
'as': 'collection_unite_enseignement'
}
},
{
'$unwind': '$collection_unite_enseignement'
}
])
for val in MYSY_GV.dbname['inscription_liste_ue'].aggregate(pipe_qry):
user = {}
main_field = ['_id', 'class_eu_id', 'class_id', 'inscription_id', ]
second_field = ['_id', 'code', 'titre']
for tmp in main_field :
if( str(tmp) in val.keys() ):
user[str(tmp)] = val[str(tmp)]
for tmp in second_field:
if (str(tmp) in val['collection_unite_enseignement'].keys()):
user[str(tmp)] = val['collection_unite_enseignement'][str(tmp)]
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
except Exception as e:
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, " Impossible de recuperer les UE associées à l'inscription"
"""
Cette fonction permet de recuperer la liste des types d'evaluation pour un inscrit
exemple : Pour l'UE xxxx, il est inscrit pour les 'PROJETS' seulement
"""
def Get_Inscrit_List_EU_Type_Evaluation(diction):
try:
"""
Verification de la liste des champs obligatoires
"""
field_list_obligatoire = ['token', 'inscription_id']
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, " Les informations fournies ne sont pas correctes"
mytoken = ""
if ("token" in diction.keys()):
if diction['token']:
mytoken = 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
formation_initiale = "0"
if ("formation_initiale" in my_partner.keys()):
formation_initiale = my_partner['formation_initiale']
if (formation_initiale != "1"):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Il ne s'agit pas d'un formation initiale ")
return True, " Il ne s'agit pas d'un formation initiale "
"""
Verifier que l'inscription est valide
"""
is_valide_inscription_count = MYSY_GV.dbname['inscription'].count_documents(
{'_id': ObjectId(diction['inscription_id']),
'partner_owner_recid': str(my_partner['recid']),
'valide': '1'})
if (is_valide_inscription_count != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant de l'inscrit est invalide ")
return False, " L'identifiant de l'inscrit est invalide "
RetObject = []
val_tmp = 0
qery_match = {'inscription_id': str(diction['inscription_id']), 'partner_owner_recid': str(my_partner['recid']), 'valide': '1',
'locked': '0'}
pipe_qry = ([
{'$match': qery_match},
{'$lookup': {
'from': 'type_evaluation',
"let": {'type_evaluation_id': "type_evaluation_id",
'partner_owner_recid': '$partner_owner_recid'},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$_id", {'$convert': {
'input': "$$type_evaluation_id",
'to': "objectId",
'onError': {'error': 'true'},
'onNull': {'isnull': 'true'}
}}]},
{'$eq': ["$valide", "1"]},
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']}
]
}
}
},
],
'as': 'collection_type_evaluation'
}
},
{
'$unwind': '$collection_type_evaluation'
}
])
for val in MYSY_GV.dbname['inscription_liste_ue_type_evalution'].aggregate(pipe_qry):
user = {}
main_field = ['_id', 'class_eu_id', 'class_id', 'inscription_id', 'type_evaluation_id']
second_field = ['_id', 'code', 'titre']
for tmp in main_field :
if( str(tmp) in val.keys() ):
user[str(tmp)] = val[str(tmp)]
for tmp in second_field:
if (str(tmp) in val['collection_unite_enseignement'].keys()):
user[str(tmp)] = val['collection_unite_enseignement'][str(tmp)]
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
except Exception as e:
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, " Impossible de recuperer les UE associées à l'inscription"

File diff suppressed because it is too large Load Diff

12
main.py
View File

@ -4546,6 +4546,18 @@ def Get_Accepted_Insription_From_Session_id_Reduice_Fields():
return jsonify(status=status, message=retval) return jsonify(status=status, message=retval)
"""
API qui permet de recuperer la liste des UE associées à une incription
"""
@app.route('/myclass/api/Get_Inscrit_List_EU/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Inscrit_List_EU():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Inscrit_List_EU payload = ",payload)
status, retval = inscription.Get_Inscrit_List_EU(payload)
return jsonify(status=status, message=retval)
""" """