parent
351b833c40
commit
baf7d42372
|
|
@ -4,17 +4,14 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="13/05/26 - 17h">
|
||||
<change afterPath="$PROJECT_DIR$/Diplome_mgt.py" afterDir="false" />
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="15/05/2026 - 17h30">
|
||||
<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$/Diplome_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Diplome_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$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bloc_competence.py" beforeDir="false" afterPath="$PROJECT_DIR$/bloc_competence.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$/note_evaluation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/note_evaluation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
|
@ -459,7 +456,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="581" />
|
||||
<option name="localTasksCounter" value="582" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -501,7 +498,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="23/03/26 - 20h" />
|
||||
<MESSAGE value="04/04/26 - 20h" />
|
||||
<MESSAGE value="07/04/2026 - 14h" />
|
||||
<MESSAGE value="10/04/2026 - 18h" />
|
||||
|
|
@ -526,6 +522,7 @@
|
|||
<MESSAGE value="11/05/2026 -22h" />
|
||||
<MESSAGE value="qsd" />
|
||||
<MESSAGE value="13/05/26 - 17h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="13/05/26 - 17h" />
|
||||
<MESSAGE value="15/05/2026 - 17h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="15/05/2026 - 17h30" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -215,7 +215,7 @@ def Update_Diplome(diction):
|
|||
" Impossible de mettre à jour le diplome (2) ")
|
||||
return False, " Impossible de mettre à jour le diplome (2) "
|
||||
|
||||
return True, " Lediplome a été correctement mis à jour"
|
||||
return True, " Le diplome a été correctement mis à jour"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
|
|||
3142
Log/log_file.log
3142
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
|
@ -462,10 +462,33 @@ def Get_Given_bloc_competence(diction):
|
|||
|
||||
local_node['creation_date'] = str(ue_competence['creation_date'])
|
||||
|
||||
if( "semestre" in ue_competence.keys() ):
|
||||
local_node['semestre'] = str(ue_competence['semestre'])
|
||||
#---
|
||||
if ("coefficient" in ue_competence.keys()):
|
||||
local_node['coefficient'] = str(ue_competence['coefficient'])
|
||||
else:
|
||||
local_node['semestre'] = ""
|
||||
local_node['coefficient'] = ""
|
||||
|
||||
if ("seuil_validation" in ue_competence.keys()):
|
||||
local_node['seuil_validation'] = str(ue_competence['seuil_validation'])
|
||||
else:
|
||||
local_node['seuil_validation'] = ""
|
||||
|
||||
if ("is_noted" in ue_competence.keys()):
|
||||
local_node['is_noted'] = str(ue_competence['is_noted'])
|
||||
else:
|
||||
local_node['is_noted'] = ""
|
||||
|
||||
if ("pres_dist_hyp" in ue_competence.keys()):
|
||||
local_node['pres_dist_hyp'] = str(ue_competence['pres_dist_hyp'])
|
||||
else:
|
||||
local_node['pres_dist_hyp'] = ""
|
||||
|
||||
if ("credit" in ue_competence.keys()):
|
||||
local_node['credit'] = str(ue_competence['credit'])
|
||||
else:
|
||||
local_node['credit'] = ""
|
||||
|
||||
|
||||
|
||||
local_diplome_id = ""
|
||||
local_diplome_code = ""
|
||||
|
|
@ -523,6 +546,33 @@ def Get_Given_bloc_competence(diction):
|
|||
else:
|
||||
local_node['semestre'] = ""
|
||||
|
||||
# ---
|
||||
if ("coefficient" in ue_competence.keys()):
|
||||
local_node['coefficient'] = str(ue_competence['coefficient'])
|
||||
else:
|
||||
local_node['coefficient'] = ""
|
||||
|
||||
if ("seuil_validation" in ue_competence.keys()):
|
||||
local_node['seuil_validation'] = str(ue_competence['seuil_validation'])
|
||||
else:
|
||||
local_node['seuil_validation'] = ""
|
||||
|
||||
if ("is_noted" in ue_competence.keys()):
|
||||
local_node['is_noted'] = str(ue_competence['is_noted'])
|
||||
else:
|
||||
local_node['is_noted'] = ""
|
||||
|
||||
if ("pres_dist_hyp" in ue_competence.keys()):
|
||||
local_node['pres_dist_hyp'] = str(ue_competence['pres_dist_hyp'])
|
||||
else:
|
||||
local_node['pres_dist_hyp'] = ""
|
||||
|
||||
if ("credit" in ue_competence.keys()):
|
||||
local_node['credit'] = str(ue_competence['credit'])
|
||||
else:
|
||||
local_node['credit'] = ""
|
||||
|
||||
|
||||
local_diplome_id = ""
|
||||
local_diplome_code = ""
|
||||
if ("diplome_id" in ue_competence.keys() and ue_competence['diplome_id']):
|
||||
|
|
@ -901,7 +951,8 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'bloc_competence_id', 'ue_id', 'competence_id', 'domaine_competence_id',
|
||||
'type_association', 'semestre', 'diplome_id']
|
||||
'type_association', 'semestre', 'diplome_id', 'coefficient', 'seuil_validation',
|
||||
'is_noted', 'pres_dist_hyp', 'credit']
|
||||
|
||||
"""
|
||||
type_association = "1" => association avec un domaine de compétence
|
||||
|
|
@ -1181,6 +1232,34 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
|
|||
else:
|
||||
new_data['diplome_id'] = ""
|
||||
|
||||
#---
|
||||
if ("coefficient" in diction.keys()):
|
||||
new_data['coefficient'] = diction['coefficient']
|
||||
else:
|
||||
new_data['coefficient'] = ""
|
||||
|
||||
|
||||
if ("seuil_validation" in diction.keys()):
|
||||
new_data['seuil_validation'] = diction['seuil_validation']
|
||||
else:
|
||||
new_data['seuil_validation'] = ""
|
||||
|
||||
if ("is_noted" in diction.keys()):
|
||||
new_data['is_noted'] = diction['is_noted']
|
||||
else:
|
||||
new_data['is_noted'] = ""
|
||||
|
||||
if ("pres_dist_hyp" in diction.keys()):
|
||||
new_data['pres_dist_hyp'] = diction['pres_dist_hyp']
|
||||
else:
|
||||
new_data['pres_dist_hyp'] = ""
|
||||
|
||||
if ("credit" in diction.keys()):
|
||||
new_data['credit'] = diction['credit']
|
||||
else:
|
||||
new_data['credit'] = ""
|
||||
|
||||
|
||||
|
||||
new_data['valide'] = "1"
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
|
|
|
|||
191
class_mgt.py
191
class_mgt.py
|
|
@ -8670,3 +8670,194 @@ def Get_Given_Class_List_Default_Documents_For_Given_Type_Doc(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la liste des documents par défaut"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction alimente la liste des UE d'un formation
|
||||
a partir d'une referentiel
|
||||
"""
|
||||
def Update_Class_UE_From_Ref_pedago(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'class_id', 'ref_pedo_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', 'class_id', 'ref_pedo_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 la liste des arguments ")
|
||||
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
|
||||
|
||||
|
||||
# Verifier la validité du referentiel pédago
|
||||
is_valide_ref_pedago = MYSY_GV.dbname['bloc_competence'].count_documents({'_id':ObjectId(str(diction['ref_pedo_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_ref_pedago != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du référentiel pédagogique est invalide ")
|
||||
return False, " L'identifiant du référentiel pédagogique est invalide "
|
||||
|
||||
# Verifier la validité de la formation
|
||||
is_valide_class = MYSY_GV.dbname['myclass'].count_documents({'_id': ObjectId(str(diction['class_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_valide_class != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la formation est invalide ")
|
||||
return False, " L'identifiant de la formation est invalide "
|
||||
|
||||
|
||||
|
||||
|
||||
ref_pedago_data = MYSY_GV.dbname['bloc_competence'].find_one(
|
||||
{'_id': ObjectId(str(diction['ref_pedo_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
""""
|
||||
Important : Vu l'impact du changement des UE sur une formation, on ne va pas faire une simple suppression
|
||||
On va plutot stocker l'ue actuelle dans une collection à coté.
|
||||
par exemple renommer class['list_unite_enseignement'] en class['list_unite_enseignement_old_datajour_secd']
|
||||
"""
|
||||
class_data = MYSY_GV.dbname['myclass'].find_one({'_id': ObjectId(str(diction['class_id'])), 'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
|
||||
if( class_data and "list_unite_enseignement" in class_data.keys()):
|
||||
now = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
nouveau_nom_champ = f"list_unite_enseignement_{now}"
|
||||
result = MYSY_GV.dbname['myclass'].update_many(
|
||||
{'_id': ObjectId(str(diction['class_id'])), 'partner_owner_recid': str(my_partner['recid'])},
|
||||
{
|
||||
"$rename": {
|
||||
"list_unite_enseignement": nouveau_nom_champ
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
if(ref_pedago_data and "tab_ue" in ref_pedago_data.keys() ):
|
||||
for local_ue in ref_pedago_data['tab_ue']:
|
||||
print(" ### aJOUTER L'UEE local_ue = ", local_ue)
|
||||
|
||||
new_data = {}
|
||||
new_data['update_date'] = str(datetime.now())
|
||||
new_data['valide'] = "1"
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
new_data['locked'] = "0"
|
||||
|
||||
if( "credit" in local_ue.keys() ):
|
||||
new_data['credit'] = str(local_ue['credit'])
|
||||
else:
|
||||
new_data['credit'] = ""
|
||||
|
||||
if ("pres_dist_hyp" in local_ue.keys()):
|
||||
new_data['pres_dist_hyp'] = str(local_ue['pres_dist_hyp'])
|
||||
else:
|
||||
new_data['pres_dist_hyp'] = ""
|
||||
|
||||
if ("is_noted" in local_ue.keys()):
|
||||
new_data['is_noted'] = str(local_ue['is_noted'])
|
||||
else:
|
||||
new_data['is_noted'] = ""
|
||||
|
||||
if ("coefficient" in local_ue.keys()):
|
||||
new_data['coefficient'] = str(local_ue['coefficient'])
|
||||
else:
|
||||
new_data['coefficient'] = ""
|
||||
|
||||
if ("seuil_validation" in local_ue.keys()):
|
||||
new_data['seuil_validation'] = str(local_ue['seuil_validation'])
|
||||
else:
|
||||
new_data['seuil_validation'] = ""
|
||||
|
||||
if ("semestre" in local_ue.keys()):
|
||||
new_data['semestre'] = str(local_ue['semestre'])
|
||||
else:
|
||||
new_data['semestre'] = ""
|
||||
|
||||
if ("diplome_id" in local_ue.keys()):
|
||||
new_data['diplome_id'] = str(local_ue['diplome_id'])
|
||||
else:
|
||||
new_data['diplome_id'] = ""
|
||||
|
||||
|
||||
|
||||
new_data['_id'] = str(local_ue['ue_id'])
|
||||
|
||||
new_data['type_association'] = str(local_ue['type_association'])
|
||||
new_data['competence_id'] = str(local_ue['competence_id'])
|
||||
new_data['domaine_competence_id'] = str(local_ue['domaine_competence_id'])
|
||||
|
||||
new_data['mysy_single_field'] = str(local_ue['mysy_single_field'])
|
||||
|
||||
insert = MYSY_GV.dbname['myclass'].update_one({'_id': ObjectId(str(diction['class_id'])),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
},
|
||||
|
||||
{
|
||||
'$push': {
|
||||
"list_unite_enseignement": {
|
||||
'$each': [new_data]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
)
|
||||
|
||||
|
||||
# pour la collection 'myclass'
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
# print(" ####### laaaa diction = ", diction)
|
||||
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(token)
|
||||
history_event_dict['related_collection'] = "myclass"
|
||||
history_event_dict['related_collection_recid'] = str(diction['class_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
history_event_dict['action_description'] = "Mise à jour du referentiel pédagogique"
|
||||
|
||||
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
|
||||
return True, " Le referentiel a été ajouté à la formation"
|
||||
|
||||
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 d'ajouter le referentiel a la formation "
|
||||
|
|
|
|||
31
main.py
31
main.py
|
|
@ -12093,6 +12093,21 @@ def Publish_Unpublish_Participant_Evaluation_Note():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API pour valider les notes evaluation
|
||||
à une évaluation
|
||||
"""
|
||||
@app.route('/myclass/api/Valide_Participant_Evaluation_Note/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Valide_Participant_Evaluation_Note():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Valide_Participant_Evaluation_Note payload = ",payload)
|
||||
status, retval = note_evaluation_mgt.Valide_Participant_Evaluation_Note(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour Recuperer la liste des inscrits et groupe inscrit à une
|
||||
|
|
@ -15837,6 +15852,22 @@ def Get_Given_Class_List_Default_Documents_For_Given_Type_Doc():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre à jours les UE d'une formation suite à la modification du referentiel pédagp
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Class_UE_From_Ref_pedago/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Class_UE_From_Ref_pedago():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Class_UE_From_Ref_pedago payload = ",payload)
|
||||
status, retval = cm.Update_Class_UE_From_Ref_pedago(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter un message d'alert ENT
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -2275,6 +2275,7 @@ def Update_Participant_Evaluation_Note(diction):
|
|||
else:
|
||||
new_data['publish'] = "0"
|
||||
|
||||
new_data['is_validated'] = "0"
|
||||
|
||||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
|
|
@ -2290,6 +2291,24 @@ def Update_Participant_Evaluation_Note(diction):
|
|||
upsert=False,
|
||||
)
|
||||
|
||||
# pour la collection 'myclass'
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
# print(" ####### laaaa diction = ", diction)
|
||||
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(token)
|
||||
history_event_dict['related_collection'] = "note_evaluation"
|
||||
history_event_dict['related_collection_recid'] = str(diction['evaluation_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
history_event_dict['action_description'] = "Mise à jour des notes"
|
||||
|
||||
history_event_dict['action_description'] = JSON_tab_participant_note
|
||||
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
return True, " La mise à jour des notes été correctement faite"
|
||||
|
||||
|
|
@ -2365,6 +2384,160 @@ def Publish_Unpublish_Participant_Evaluation_Note(diction):
|
|||
|
||||
tab_id_to_update = []
|
||||
|
||||
tab_inscription_id = str(diction['tab_inscription_id']).split(",")
|
||||
|
||||
qry_complement = {}
|
||||
if( diction['publish_status'] == "1"):
|
||||
qry_complement = { 'is_validated':'1'}
|
||||
|
||||
for inscription_id in tab_inscription_id:
|
||||
if( inscription_id ):
|
||||
# Verifier que le stagiaire est bien inscrit. Le statut de l'inscription doit etre "1"
|
||||
|
||||
is_inscription_valide = MYSY_GV.dbname['note_evaluation_participant'].count_documents(
|
||||
{'$and':[
|
||||
{'_id': ObjectId(str(inscription_id)),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
}, qry_complement ] } )
|
||||
|
||||
if (is_inscription_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'inscription " + str(inscription_id) + " est invalide ")
|
||||
return False, " L'identifiant de l'inscription " + str(inscription_id) + " est invalide "
|
||||
|
||||
tab_id_to_update.append(ObjectId(str(inscription_id)))
|
||||
|
||||
|
||||
warning_msg = ""
|
||||
is_warning = ""
|
||||
|
||||
new_data = {}
|
||||
new_data['update_date'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
new_data['publish'] = str(diction['publish_status'])
|
||||
|
||||
if( str(diction['publish_status']) == "1"):
|
||||
new_data['publish_date'] = str(datetime.now())
|
||||
new_data['publish_by'] = str(my_partner['_id'])
|
||||
|
||||
if (str(diction['publish_status']) == "0"):
|
||||
new_data['unpublish_date'] = str(datetime.now())
|
||||
new_data['unpublish_by'] = str(my_partner['_id'])
|
||||
|
||||
# Suppression des inscription
|
||||
if( len(tab_id_to_update) > 0 and tab_id_to_update[0]):
|
||||
qry_update_inscription = {'partner_owner_recid': str(my_partner['recid']),
|
||||
"_id": {"$in": tab_id_to_update},
|
||||
}
|
||||
|
||||
print(" ### qry_update_inscription = ", qry_update_inscription )
|
||||
|
||||
MYSY_GV.dbname['note_evaluation_participant'].update_many(
|
||||
qry_update_inscription,
|
||||
{'$set': new_data}
|
||||
)
|
||||
|
||||
# pour la collection 'myclass'
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
# print(" ####### laaaa diction = ", diction)
|
||||
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(token)
|
||||
history_event_dict['related_collection'] = "note_evaluation"
|
||||
history_event_dict['related_collection_recid'] = str(diction['evaluation_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
if( diction['publish_status'] == "1"):
|
||||
history_event_dict['action_description'] = "Publication des notes sur l'ENT"
|
||||
|
||||
elif (diction['publish_status'] == "0"):
|
||||
history_event_dict['action_description'] = "Dépublication des notes sur l'ENT"
|
||||
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
return True, " La mise à jour 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 mettre à jour les données"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de valider des notes
|
||||
"""
|
||||
def Valide_Participant_Evaluation_Note(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'evaluation_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', 'evaluation_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 la liste des arguments ")
|
||||
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
|
||||
|
||||
"""
|
||||
Verifier si l'utilisateur a le droit de valider les notes
|
||||
"""
|
||||
user_secure_acces = MYSY_GV.dbname['user_access_right'].count_documents(
|
||||
{'module_name': 'note_validation', 'user_id': str(my_partner['ressource_humaine_id']),
|
||||
'valide': '1', 'write': True})
|
||||
|
||||
if (user_secure_acces != 1):
|
||||
return False, " Vos droits ne sont pas suffisants pour valider les notes "
|
||||
|
||||
|
||||
"""
|
||||
Verifier que l'evaluation est valide
|
||||
"""
|
||||
is_evaluation_valide = MYSY_GV.dbname['note_evaluation'].count_documents(
|
||||
{"_id": ObjectId(str(diction['evaluation_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_evaluation_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'évaluation n'est pas valide ")
|
||||
return False, " L'identifiant de l'évaluation n'est pas valide "
|
||||
|
||||
tab_id_to_update = []
|
||||
|
||||
tab_inscription_id = str(diction['tab_inscription_id']).split(",")
|
||||
for inscription_id in tab_inscription_id:
|
||||
if( inscription_id ):
|
||||
|
|
@ -2389,7 +2562,9 @@ def Publish_Unpublish_Participant_Evaluation_Note(diction):
|
|||
new_data = {}
|
||||
new_data['update_date'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
new_data['publish'] = str(diction['publish_status'])
|
||||
new_data['is_validated'] = "1"
|
||||
new_data['is_validated_date'] = str(datetime.now())
|
||||
new_data['is_validated_by'] = str(my_partner['_id'])
|
||||
|
||||
# Suppression des inscription
|
||||
if( len(tab_id_to_update) > 0 and tab_id_to_update[0]):
|
||||
|
|
@ -2404,7 +2579,22 @@ def Publish_Unpublish_Participant_Evaluation_Note(diction):
|
|||
{'$set': new_data}
|
||||
)
|
||||
|
||||
# pour la collection 'myclass'
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
# print(" ####### laaaa diction = ", diction)
|
||||
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(token)
|
||||
history_event_dict['related_collection'] = "note_evaluation"
|
||||
history_event_dict['related_collection_recid'] = str(diction['evaluation_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
history_event_dict['action_description'] = "Validation des notees"
|
||||
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
return True, " La mise à jour correctement faite"
|
||||
|
||||
|
|
@ -2415,7 +2605,6 @@ def Publish_Unpublish_Participant_Evaluation_Note(diction):
|
|||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des inscrits et groupe inscrit à une
|
||||
evaluation
|
||||
|
|
@ -2519,6 +2708,19 @@ def Get_List_Participant_To_Evaluation(diction):
|
|||
elif ("publish" in retval.keys() and retval['publish'] != "1"):
|
||||
user['publish'] = False
|
||||
|
||||
if ("is_validated" not in retval.keys()):
|
||||
user['is_validated'] = False
|
||||
|
||||
if ("is_validated" in retval.keys() and retval['is_validated'] == "1"):
|
||||
user['is_validated'] = True
|
||||
elif ("is_validated" in retval.keys() and retval['is_validated'] != "1"):
|
||||
user['is_validated'] = False
|
||||
|
||||
if ("is_validated_date" not in retval.keys()):
|
||||
user['is_validated_date'] = ""
|
||||
else:
|
||||
user['is_validated_date'] = retval['is_validated_date']
|
||||
|
||||
|
||||
if( "convocation_send_date" not in user.keys() ):
|
||||
user['convocation_send_date'] = ""
|
||||
|
|
@ -2686,11 +2888,37 @@ def Get_List_Participant_Notes(diction):
|
|||
if ("publish" not in retval.keys()):
|
||||
user['publish'] = False
|
||||
|
||||
if ("publish_date" not in retval.keys()):
|
||||
user['publish_date'] = ""
|
||||
|
||||
if ("publish_by" not in retval.keys()):
|
||||
user['publish_by'] = ""
|
||||
|
||||
if ("publish" in retval.keys() and retval['publish'] == "1"):
|
||||
user['publish'] = True
|
||||
elif ("publish" in retval.keys() and retval['publish'] != "1"):
|
||||
user['publish'] = False
|
||||
|
||||
|
||||
if ("is_validated" not in retval.keys()):
|
||||
user['is_validated'] = False
|
||||
|
||||
if ("is_validated_date" not in retval.keys()):
|
||||
user['is_validated_date'] = ""
|
||||
else:
|
||||
user['is_validated_date'] = retval['is_validated_date']
|
||||
|
||||
if ("is_validated_by" not in retval.keys()):
|
||||
user['is_validated_by'] = ""
|
||||
else:
|
||||
user['is_validated_by'] = retval['is_validated_by']
|
||||
|
||||
if ("is_validated" in retval.keys() and retval['is_validated'] == "1"):
|
||||
user['is_validated'] = True
|
||||
elif ("is_validated" in retval.keys() and retval['is_validated'] != "1"):
|
||||
user['is_validated'] = False
|
||||
|
||||
|
||||
user['note_evaluation_id'] = str(retval['note_evaluation_collection'][0]['_id'])
|
||||
user['note_evaluation_code'] = str(retval['note_evaluation_collection'][0]['code'])
|
||||
|
||||
|
|
|
|||
|
|
@ -897,7 +897,41 @@ def Get_List_Unite_Enseignement_Of_Given_Class(diction):
|
|||
if ("seuil_validation" not in user.keys()):
|
||||
user['seuil_validation'] = "99"
|
||||
|
||||
if ("semestre" not in user.keys()):
|
||||
user['semestre'] = ""
|
||||
|
||||
domaine_competence_code = ""
|
||||
domaine_competence_id = ""
|
||||
if ("domaine_competence_id" in user.keys() and user['domaine_competence_id']):
|
||||
domaine_competence_id_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one({'_id': ObjectId(str(user['domaine_competence_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if( domaine_competence_id_data and "code" in domaine_competence_id_data.keys() ):
|
||||
domaine_competence_code = str(domaine_competence_id_data['code'])
|
||||
domaine_competence_id = str(user['domaine_competence_id'])
|
||||
|
||||
user['domaine_competence_id'] = str(domaine_competence_id)
|
||||
user['domaine_competence_code'] = str(domaine_competence_code)
|
||||
|
||||
competence_code = ""
|
||||
competence_id = ""
|
||||
if ("competence_id" in user.keys() and user['competence_id']):
|
||||
competence_id_data = MYSY_GV.dbname['competence_pedagogique'].find_one(
|
||||
{'_id': ObjectId(str(user['competence_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (competence_id_data and "code" in competence_id_data.keys()):
|
||||
competence_code = str(competence_id_data['code'])
|
||||
competence_id = str(user['competence_id'])
|
||||
|
||||
user['competence_id'] = str(competence_id)
|
||||
user['competence_code'] = str(competence_code)
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
|
@ -1040,6 +1074,43 @@ def Get_List_Unite_Enseignement_Of_Given_Class_From_Session_Id(diction):
|
|||
if ("seuil_validation" not in user.keys()):
|
||||
user['seuil_validation'] = "99"
|
||||
|
||||
if ("semestre" not in user.keys()):
|
||||
user['semestre'] = ""
|
||||
|
||||
domaine_competence_code = ""
|
||||
domaine_competence_id = ""
|
||||
if ("domaine_competence_id" in user.keys() and user['domaine_competence_id']):
|
||||
domaine_competence_id_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one({'_id': ObjectId(str(user['domaine_competence_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if( domaine_competence_id_data and "code" in domaine_competence_id_data.keys() ):
|
||||
domaine_competence_code = str(domaine_competence_id_data['code'])
|
||||
domaine_competence_id = str(user['domaine_competence_id'])
|
||||
|
||||
user['domaine_competence_id'] = str(domaine_competence_id)
|
||||
user['domaine_competence_code'] = str(domaine_competence_code)
|
||||
|
||||
competence_code = ""
|
||||
competence_id = ""
|
||||
if ("competence_id" in user.keys() and user['competence_id']):
|
||||
competence_id_data = MYSY_GV.dbname['competence_pedagogique'].find_one(
|
||||
{'_id': ObjectId(str(user['competence_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (competence_id_data and "code" in competence_id_data.keys()):
|
||||
competence_code = str(competence_id_data['code'])
|
||||
competence_id = str(user['competence_id'])
|
||||
|
||||
user['competence_id'] = str(competence_id)
|
||||
user['competence_code'] = str(competence_code)
|
||||
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue