07/06/2024 - 22h30

master
cherif 2024-06-07 22:14:32 +02:00
parent e9f6d7b351
commit 58745ba95c
4 changed files with 1883 additions and 14 deletions

View File

@ -1,12 +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="06/06/2024 - 12h"> <list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="06/06/2024 - 20h">
<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$/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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/note_evaluation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/note_evaluation_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.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" />
@ -76,13 +75,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1680804787304</updated> <updated>1680804787304</updated>
</task> </task>
<task id="LOCAL-00277" summary="25/04/2024 - 19h">
<created>1714064812225</created>
<option name="number" value="00277" />
<option name="presentableId" value="LOCAL-00277" />
<option name="project" value="LOCAL" />
<updated>1714064812226</updated>
</task>
<task id="LOCAL-00278" summary="25/04/2024 - 19h"> <task id="LOCAL-00278" summary="25/04/2024 - 19h">
<created>1714065354319</created> <created>1714065354319</created>
<option name="number" value="00278" /> <option name="number" value="00278" />
@ -419,7 +411,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1717668732176</updated> <updated>1717668732176</updated>
</task> </task>
<option name="localTasksCounter" value="326" /> <task id="LOCAL-00326" summary="06/06/2024 - 20h">
<created>1717697890411</created>
<option name="number" value="00326" />
<option name="presentableId" value="LOCAL-00326" />
<option name="project" value="LOCAL" />
<updated>1717697890412</updated>
</task>
<option name="localTasksCounter" value="327" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -461,7 +460,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="12/05/2024 - 21h30" />
<MESSAGE value="13/05/2024 - 18h30" /> <MESSAGE value="13/05/2024 - 18h30" />
<MESSAGE value="14/05/2024 - 21h30" /> <MESSAGE value="14/05/2024 - 21h30" />
<MESSAGE value="sds" /> <MESSAGE value="sds" />
@ -486,6 +484,7 @@
<MESSAGE value="qsdsqsqdsq" /> <MESSAGE value="qsdsqsqdsq" />
<MESSAGE value="05/06/2024 - 23h" /> <MESSAGE value="05/06/2024 - 23h" />
<MESSAGE value="06/06/2024 - 12h" /> <MESSAGE value="06/06/2024 - 12h" />
<option name="LAST_COMMIT_MESSAGE" value="06/06/2024 - 12h" /> <MESSAGE value="06/06/2024 - 20h" />
<option name="LAST_COMMIT_MESSAGE" value="06/06/2024 - 20h" />
</component> </component>
</project> </project>

File diff suppressed because it is too large Load Diff

16
main.py
View File

@ -9668,6 +9668,22 @@ def Get_List_Participant_To_Evaluation():
"""
API pour Recuperer les notes d'un apprenant sur une liste de sessions
"""
@app.route('/myclass/api/Get_List_Participant_Notes/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_List_Participant_Notes():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_Participant_Notes payload = ",payload)
status, retval = note_evaluation_mgt.Get_List_Participant_Notes(payload)
return jsonify(status=status, message=retval)
""" """
API pour exporter les notes d'une évaluation API pour exporter les notes d'une évaluation
""" """

View File

@ -1279,6 +1279,212 @@ def Get_List_Participant_To_Evaluation(diction):
return False, "Impossible de récupérer la liste des inscrits à l'évaluation" return False, "Impossible de récupérer la liste des inscrits à l'évaluation"
"""
Recuperation des notes d'un inscrit a une liste de session_id
"""
def Get_List_Participant_Notes(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'tab_session_id', 'tab_inscription_id']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
mycommon.myprint(str(
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
return False, " Les informations fournies sont incorrectes"
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'tab_session_id', 'tab_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 sont incorrectes"
"""
Verification de l'identité et autorisation de l'entité qui
appelle cette API
"""
token = ""
if ("token" in diction.keys()):
if diction['token']:
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_session_id = ""
if ("tab_session_id" in diction.keys()):
if diction['tab_session_id']:
tab_session_id = diction['tab_session_id']
tab_inscription_id = ""
if ("tab_inscription_id" in diction.keys()):
if diction['tab_inscription_id']:
tab_inscription_id = diction['tab_inscription_id']
tab_my_session_ids = str(tab_session_id).split(",")
tab_my_inscription_ids = str(tab_inscription_id).split(",")
"""
Verification de la validité de la liste des inscription
"""
print("tab_my_session_ids = ", tab_my_session_ids)
for my_inscription_id in tab_my_inscription_ids:
# Verifier qui la formation n'a pas deja été evaluée
tmp_count = MYSY_GV.dbname['inscription'].count_documents({'session_id': {'$in': tab_my_session_ids, },
'_id': ObjectId(str(my_inscription_id)),
'partner_owner_recid': str(my_partner['recid']),
} )
if (tmp_count != 1):
mycommon.myprint(str(inspect.stack()[0][3]) + " L'inscription "+str(my_inscription_id)+" est invalide ")
return False, " L'inscription "+str(my_inscription_id)+" est invalide "
"""
Verification de la validité de la liste des sessions
"""
for my_session_ids in tab_my_session_ids:
# Verifier qui la formation n'a pas deja été evaluée
tmp_count = MYSY_GV.dbname['session_formation'].count_documents({'_id': ObjectId(str(my_session_ids)),
'partner_owner_recid': str(my_partner['recid']),
'valide':'1'
} )
if (tmp_count != 1):
mycommon.myprint(str(inspect.stack()[0][3]) + " La session "+str(my_session_ids)+" est invalide ")
return False, " L'inscription "+str(my_session_ids)+" est invalide "
RetObject = []
nb_val = 0
query = [{'$match': {'inscription_id': {'$in':tab_my_inscription_ids}, 'partner_owner_recid': str(my_partner['recid']),
}},
{'$sort': {'_id': -1}},
{'$lookup':
{
'from': 'note_evaluation',
"let": {'evaluation_id': "$evaluation_id", 'partner_owner_recid': '$partner_owner_recid'},
'pipeline': [{'$match':
{'$expr': {'$and': [
{'$eq': ["$valide", "1"]},
{'$eq': ["$_id", {'$convert': {
'input': "$$evaluation_id",
'to': "objectId",
'onError': {'error': 'true'},
'onNull': {'isnull': 'true'}
}}]},
]}}},
], 'as': 'note_evaluation_collection'}
}
]
print("#### Get_List_Participant_Notes laa 01 : query = ", query)
for retval in MYSY_GV.dbname['note_evaluation_participant'].aggregate(query):
if( "note_evaluation_collection" in retval.keys() ):
user = {}
nom_apprenant = ""
prenom_apprenant = ""
email_apprenant = ""
groupe = ""
if( "inscription_id" in retval and retval['inscription_id']):
# Recuprer les données de l'inscrit
inscription_data = MYSY_GV.dbname['inscription'].find_one({'_id':ObjectId(str(retval['inscription_id']))},
{'_id':1, 'apprenant_id':1})
apprenant_data = MYSY_GV.dbname['apprenant'].find_one({'_id':ObjectId(str(inscription_data['apprenant_id']))},
{'_id':1, 'nom':1, 'prenom':1, 'email':1})
nom_apprenant = apprenant_data['nom']
prenom_apprenant = apprenant_data['prenom']
email_apprenant = apprenant_data['email']
user['_id'] = str(retval['_id'])
user['evaluation_id'] = str(retval['evaluation_id'])
user['inscription_id'] = str(retval['inscription_id'])
user['note'] = str(retval['note'])
user['note_evaluation_id'] = str(retval['note_evaluation_collection'][0]['_id'])
user['note_evaluation_code'] = str(retval['note_evaluation_collection'][0]['code'])
user['note_evaluation_titre'] = str(retval['note_evaluation_collection'][0]['titre'])
user['session_id'] = str(retval['note_evaluation_collection'][0]['class_id'])
user['class_eu_id'] = str(retval['note_evaluation_collection'][0]['class_eu_id'])
class_ue_code = ""
class_ue_titre = ""
ue_data = MYSY_GV.dbname['unite_enseignement'].find_one({'_id':ObjectId(str(user['class_eu_id'])),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( "code" in ue_data.keys() ):
class_ue_code = str(ue_data['code'])
if ("titre" in ue_data.keys()):
class_ue_titre = str(ue_data['titre'])
user['class_ue_code'] = class_ue_code
user['class_ue_titre'] = class_ue_titre
user['type_eval_id'] = str(retval['note_evaluation_collection'][0]['type_eval_id'])
type_eval_data = MYSY_GV.dbname['type_eval_id'].find_one({'_id':ObjectId(str(user['type_eval_id'])),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( type_eval_data and 'code' in type_eval_data.keys() ):
user['type_eval_code'] = type_eval_data['code']
else:
user['type_eval_code'] = ""
user['eval_date_heure_debut'] = str(retval['note_evaluation_collection'][0]['eval_date_heure_debut'])
user['eval_date_heure_fin'] = str(retval['note_evaluation_collection'][0]['eval_date_heure_fin'])
user['nom'] = nom_apprenant
user['prenom'] = prenom_apprenant
user['email'] = email_apprenant
user['id'] = str(nb_val)
if( "note" not in retval.keys() ):
user['note'] = "-1"
nb_val = nb_val + 1
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
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 récupérer les notes de l'apprenant"
""" """
Fonction qui permet d'exporter les notes dans un fichier excel Fonction qui permet d'exporter les notes dans un fichier excel