08/08/2024 - 20h30
parent
0b5cc35810
commit
e4ce58e726
|
@ -1,10 +1,14 @@
|
|||
<?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="02/08/2024 - 17h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="03/08/2024 - 18h30">
|
||||
<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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/groupe_inscrit_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_inscrit_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.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" />
|
||||
|
@ -75,13 +79,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00317" summary="qsdsqqsdsq">
|
||||
<created>1717062509327</created>
|
||||
<option name="number" value="00317" />
|
||||
<option name="presentableId" value="LOCAL-00317" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1717062509328</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00318" summary="sd">
|
||||
<created>1717150367241</created>
|
||||
<option name="number" value="00318" />
|
||||
|
@ -418,7 +415,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1722623009656</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="366" />
|
||||
<task id="LOCAL-00366" summary="03/08/2024 - 18h30">
|
||||
<created>1722703608290</created>
|
||||
<option name="number" value="00366" />
|
||||
<option name="presentableId" value="LOCAL-00366" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1722703608307</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="367" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -460,7 +464,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="qsds" />
|
||||
<MESSAGE value="26/06/2024 - 19h30" />
|
||||
<MESSAGE value="ww" />
|
||||
<MESSAGE value="wws" />
|
||||
|
@ -485,6 +488,7 @@
|
|||
<MESSAGE value="01/08/2024 - 17h30" />
|
||||
<MESSAGE value="02/08/2024 - 12h" />
|
||||
<MESSAGE value="02/08/2024 - 17h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="02/08/2024 - 17h" />
|
||||
<MESSAGE value="03/08/2024 - 18h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="03/08/2024 - 18h30" />
|
||||
</component>
|
||||
</project>
|
11854
Log/log_file.log
11854
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -1409,6 +1409,8 @@ def GetAllValideSessionPartner_List(diction):
|
|||
else:
|
||||
val['domaine'] = ""
|
||||
|
||||
val['class_id'] = retVal['myclass_collection'][0]['_id']
|
||||
|
||||
val['class_external_code'] = retVal['myclass_collection'][0]['external_code']
|
||||
|
||||
if( str(retVal['myclass_collection'][0]['duration_unit']) == "heure"):
|
||||
|
@ -4546,6 +4548,10 @@ def Duplicate_List_Session_Formation(diction):
|
|||
|
||||
duplicated_session = session_data
|
||||
del duplicated_session['_id']
|
||||
if( "invoiced_statut" in duplicated_session ):
|
||||
del duplicated_session['invoiced_statut']
|
||||
|
||||
|
||||
duplicated_session['code_session'] = str(session_data['code_session'])+"_dup"
|
||||
duplicated_session['date_update'] = now
|
||||
duplicated_session['update_by'] = str(my_partner['_id'])
|
||||
|
|
|
@ -56,7 +56,7 @@ def Add_Session_Sequence(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'session_id', 'sequence_title', 'sequence_start', 'sequence_end', 'agenda', 'objectif',
|
||||
'commentaire', 'check_chevauchement' ]
|
||||
'commentaire', 'check_chevauchement', 'grp_apprenant_id', 'ue_id', 'type', 'ue_planif_line_id' ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -155,9 +155,20 @@ def Add_Session_Sequence(diction):
|
|||
if( "check_chevauchement" in diction.keys() and diction['check_chevauchement'] == "0"):
|
||||
check_chevauchement = 0
|
||||
|
||||
if( check_chevauchement == 1 ):
|
||||
|
||||
local_grp_apprenant_id = ""
|
||||
if( "grp_apprenant_id" in diction.keys()):
|
||||
local_grp_apprenant_id = diction['grp_apprenant_id']
|
||||
|
||||
local_ue_id = ""
|
||||
if ("ue_id" in diction.keys()):
|
||||
local_ue_id = diction['ue_id']
|
||||
|
||||
if( check_chevauchement == 1 and str(diction['type']) == "planning" ):
|
||||
for retVal in MYSY_GV.dbname['session_formation_sequence'].find({'session_id': str(diction['session_id']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'grp_apprenant_id': str(local_grp_apprenant_id),
|
||||
'ue_id': str(local_ue_id),
|
||||
'valide':'1',
|
||||
'locked':'0'}):
|
||||
|
||||
|
@ -177,9 +188,9 @@ def Add_Session_Sequence(diction):
|
|||
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date de debut de séquence yyy " + str(
|
||||
3]) + " La date de debut de séquence " + str(
|
||||
date_debut_seq) + " chevauche une autre séquence ")
|
||||
return False, " La date de debut de séquence yyy " + str(
|
||||
return False, " La date de debut de séquence " + str(
|
||||
date_debut_seq) + " chevauche une autre séquence"
|
||||
|
||||
if (datetime.strptime(str(New_retVal_start_date), '%d/%m/%Y %H:%M') <= datetime.strptime(str(date_fin_seq), '%d/%m/%Y %H:%M') and
|
||||
|
@ -187,11 +198,16 @@ def Add_Session_Sequence(diction):
|
|||
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date de fin de séquence zzz " + str(
|
||||
3]) + " La date de fin de séquence " + str(
|
||||
date_debut_seq) + " chevauche une autre séquence ")
|
||||
return False, " La date de fin de séquence zz " + str(
|
||||
return False, " La date de fin de séquence " + str(
|
||||
date_debut_seq) + " chevauche une autre séquence"
|
||||
|
||||
sequence_type = "planning"
|
||||
if ("type" in diction.keys()):
|
||||
sequence_type = str(diction['type'])
|
||||
|
||||
|
||||
sequence_title = ""
|
||||
if( "sequence_title" in diction.keys() ):
|
||||
sequence_title = str(diction['sequence_title'])
|
||||
|
@ -208,9 +224,66 @@ def Add_Session_Sequence(diction):
|
|||
if ("commentaire" in diction.keys()):
|
||||
commentaire = str(diction['commentaire'])
|
||||
|
||||
grp_apprenant_id = ""
|
||||
if ("grp_apprenant_id" in diction.keys() and diction['grp_apprenant_id']):
|
||||
grp_apprenant_id = str(diction['grp_apprenant_id'])
|
||||
is_valide_grp_apprenant_id = MYSY_GV.dbname['groupe_inscription'].count_documents(
|
||||
{'_id': ObjectId(str(diction['grp_apprenant_id'])),
|
||||
'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
if (is_valide_grp_apprenant_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du groupe est invalide ")
|
||||
return False, " L'identifiant du groupe est invalide "
|
||||
|
||||
ue_id = ""
|
||||
if ("ue_id" in diction.keys() and diction['ue_id']):
|
||||
ue_id = str(diction['ue_id'])
|
||||
is_valide_ue_id = MYSY_GV.dbname['unite_enseignement'].count_documents({'_id':ObjectId(str( diction['ue_id'])),
|
||||
'valide':'1', 'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
if(is_valide_ue_id != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'unité d'enseignement est invalide ")
|
||||
return False, " L'identifiant de l'unité d'enseignement est invalide "
|
||||
|
||||
new_session_formation_sequence_id = ""
|
||||
ue_planif_line_id = ""
|
||||
if ("ue_id" in diction.keys() and diction['ue_id'] and "ue_planif_line_id" in diction.keys() and diction[
|
||||
'ue_planif_line_id']):
|
||||
ue_planif_line_id = str(diction['ue_planif_line_id'])
|
||||
|
||||
is_valide_unite_enseignement_planif_id = MYSY_GV.dbname['unite_enseignement_planif'].count_documents(
|
||||
{'_id': ObjectId(str(diction['ue_planif_line_id'])),
|
||||
'ue_id': str(diction['ue_id']),
|
||||
'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
})
|
||||
if (is_valide_unite_enseignement_planif_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la ligne de planification de unité d'enseignement est invalide ")
|
||||
return False, " L'identifiant de la ligne de planification de unité d'enseignement est invalide "
|
||||
|
||||
is_valide_unite_enseignement_planif_id_data = MYSY_GV.dbname['unite_enseignement_planif'].find_one(
|
||||
{'_id': ObjectId(str(diction['ue_planif_line_id'])),
|
||||
'ue_id': str(diction['ue_id']),
|
||||
'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
})
|
||||
|
||||
if(is_valide_unite_enseignement_planif_id_data and "session_formation_sequence_id" in is_valide_unite_enseignement_planif_id_data.keys() and
|
||||
is_valide_unite_enseignement_planif_id_data['session_formation_sequence_id']):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La ligne de planification de unité d'enseignement est actuellement utilisé. Impossible d'associer à cette ligne à une nouvelle séquence ")
|
||||
return False, " La ligne de planification de unité d'enseignement est actuellement utilisé. Impossible d'associer à cette ligne à une nouvelle séquence "
|
||||
|
||||
|
||||
|
||||
my_data = {}
|
||||
my_data['session_id'] = str(diction['session_id'])
|
||||
my_data['type'] = sequence_type
|
||||
my_data['sequence_title'] = sequence_title
|
||||
my_data['sequence_start'] = date_debut_seq
|
||||
my_data['sequence_end'] = date_fin_seq
|
||||
|
@ -219,15 +292,43 @@ def Add_Session_Sequence(diction):
|
|||
my_data['objectif'] = objectif
|
||||
my_data['commentaire'] = commentaire
|
||||
|
||||
my_data['grp_apprenant_id'] = grp_apprenant_id
|
||||
my_data['ue_id'] = ue_id
|
||||
my_data['unite_enseignement_planif_id'] = ue_planif_line_id
|
||||
|
||||
my_data['valide'] = "1"
|
||||
my_data['locked'] = "0"
|
||||
my_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
my_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
|
||||
MYSY_GV.dbname['session_formation_sequence'].insert_one(my_data)
|
||||
local_retval = MYSY_GV.dbname['session_formation_sequence'].insert_one(my_data)
|
||||
|
||||
new_session_formation_sequence_id = str(local_retval.inserted_id)
|
||||
"""
|
||||
Si la mise à jour fonction et qu'on a bien un update_data['ue_planif_line_id'] = str(diction['ue_planif_line_id'])
|
||||
alors on met à jour la ligne de la collection : unite_enseignement_planif.
|
||||
|
||||
1 - On programme le nouvelle ligne de planification
|
||||
|
||||
|
||||
"""
|
||||
if (ue_planif_line_id ):
|
||||
|
||||
# Programmation de la nouvelle
|
||||
update_data = {}
|
||||
update_data['date_update'] = str(datetime.now())
|
||||
update_data['update_by'] = str(my_partner['_id'])
|
||||
update_data['session_formation_sequence_id'] = str(new_session_formation_sequence_id)
|
||||
|
||||
update = MYSY_GV.dbname['unite_enseignement_planif'].update_one(
|
||||
{'_id': ObjectId(str(ue_planif_line_id)),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'},
|
||||
{'$set': update_data}
|
||||
)
|
||||
|
||||
return True, " La séquence a été correctement ajoutée"
|
||||
|
||||
|
@ -471,6 +572,7 @@ def Create_Automatic_Sequence_ORIG(diction):
|
|||
|
||||
sequence_data = {}
|
||||
sequence_data['token'] = diction['token']
|
||||
sequence_data['type'] = 'planning'
|
||||
sequence_data['session_id'] = diction['session_id']
|
||||
sequence_data['sequence_title'] = "Seq_Auto_" + str(cpt)
|
||||
sequence_data['sequence_start'] = str(single_date.strftime("%d/%m/%Y")) + " " + str(
|
||||
|
@ -478,7 +580,7 @@ def Create_Automatic_Sequence_ORIG(diction):
|
|||
sequence_data['sequence_end'] = str(single_date.strftime("%d/%m/%Y")) + " " + str(
|
||||
local_val['heure_fin']).strip()
|
||||
|
||||
#print(" ### sequence_data = ", sequence_data)
|
||||
print(" ### sequence_data = ", sequence_data)
|
||||
|
||||
local_status, local_val = Add_Session_Sequence(sequence_data)
|
||||
|
||||
|
@ -741,6 +843,7 @@ def Create_Automatic_Sequence(diction):
|
|||
|
||||
sequence_data = {}
|
||||
sequence_data['token'] = diction['token']
|
||||
sequence_data['type'] = 'planning'
|
||||
sequence_data['session_id'] = diction['session_id']
|
||||
sequence_data['sequence_title'] = "Seq_Auto_" + str(cpt)
|
||||
sequence_data['sequence_start'] = str(single_date.strftime("%d/%m/%Y")) + " "+str(matine_heure_debut)
|
||||
|
@ -757,6 +860,7 @@ def Create_Automatic_Sequence(diction):
|
|||
# La sequence de la l'apres midi
|
||||
sequence_data = {}
|
||||
sequence_data['token'] = diction['token']
|
||||
sequence_data['type'] = 'planning'
|
||||
sequence_data['session_id'] = diction['session_id']
|
||||
sequence_data['sequence_title'] = "Seq_Auto_" + str(cpt)
|
||||
sequence_data['sequence_start'] = str(single_date.strftime("%d/%m/%Y")) + " "+str(apres_midi_heure_debut)
|
||||
|
@ -819,6 +923,7 @@ def Create_Automatic_Sequence(diction):
|
|||
|
||||
sequence_data = {}
|
||||
sequence_data['token'] = diction['token']
|
||||
sequence_data['type'] = 'planning'
|
||||
sequence_data['session_id'] = diction['session_id']
|
||||
sequence_data['sequence_title'] = "Seq_Auto_" + str(cpt)
|
||||
sequence_data['sequence_start'] = str(single_date.strftime("%d/%m/%Y")) + " "+str(matine_heure_debut)
|
||||
|
@ -845,6 +950,7 @@ def Create_Automatic_Sequence(diction):
|
|||
|
||||
sequence_data = {}
|
||||
sequence_data['token'] = diction['token']
|
||||
sequence_data['type'] = 'planning'
|
||||
sequence_data['session_id'] = diction['session_id']
|
||||
sequence_data['sequence_title'] = "Seq_Auto_" + str(cpt)
|
||||
sequence_data['sequence_start'] = str(single_date.strftime("%d/%m/%Y")) + " " + str(
|
||||
|
@ -883,7 +989,7 @@ def Update_Session_Sequence(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id', 'session_id', 'sequence_title', 'sequence_start', 'sequence_end', 'agenda', 'objectif',
|
||||
'commentaire', 'check_chevauchement']
|
||||
'commentaire', 'check_chevauchement', 'grp_apprenant_id', 'ue_id', 'type', 'ue_planif_line_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -917,6 +1023,7 @@ def Update_Session_Sequence(diction):
|
|||
return local_status, my_partner
|
||||
|
||||
|
||||
|
||||
# Verification de l'existence d'une sequence à mettre à jour
|
||||
is_existe_valide_session_sequence_id = MYSY_GV.dbname["session_formation_sequence"].count_documents({'_id':ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
|
@ -928,6 +1035,18 @@ def Update_Session_Sequence(diction):
|
|||
str(inspect.stack()[0][3]) + " - L'identifiant de la séquence n'est pas valide ")
|
||||
return False, " L'identifiant de la séquence n'est pas valide "
|
||||
|
||||
old_unite_enseignement_planif_id = ""
|
||||
is_existe_valide_session_sequence_id_data = MYSY_GV.dbname["session_formation_sequence"].find_one(
|
||||
{'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if( is_existe_valide_session_sequence_id_data and "unite_enseignement_planif_id" in is_existe_valide_session_sequence_id_data.keys() ):
|
||||
old_unite_enseignement_planif_id = is_existe_valide_session_sequence_id_data['unite_enseignement_planif_id']
|
||||
|
||||
|
||||
|
||||
|
||||
# Verification de l'existence et de la session
|
||||
is_existe_valide_session_id = MYSY_GV.dbname["session_formation"].count_documents({'_id':ObjectId(str(diction['session_id'])),
|
||||
|
@ -986,12 +1105,16 @@ def Update_Session_Sequence(diction):
|
|||
if( "check_chevauchement" in diction.keys() and diction['check_chevauchement'] == "0"):
|
||||
check_chevauchement = 0
|
||||
|
||||
if( check_chevauchement == 1 ):
|
||||
if( check_chevauchement == 1 and str(diction['type']) == "planning"):
|
||||
for retVal in MYSY_GV.dbname['session_formation_sequence'].find({'session_id': str(diction['session_id']),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'grp_apprenant_id': str(
|
||||
diction['grp_apprenant_id']),
|
||||
'ue_id': str(
|
||||
diction['ue_id']),
|
||||
'_id': {'$ne': ObjectId(
|
||||
str(diction['_id']))}
|
||||
}):
|
||||
|
@ -1028,6 +1151,9 @@ def Update_Session_Sequence(diction):
|
|||
|
||||
update_data = {}
|
||||
|
||||
if ("type" in diction.keys()):
|
||||
update_data['type'] = str(diction['type'])
|
||||
|
||||
if ("sequence_title" in diction.keys()):
|
||||
update_data['sequence_title'] = str(diction['sequence_title'])
|
||||
|
||||
|
@ -1037,9 +1163,51 @@ def Update_Session_Sequence(diction):
|
|||
if ("objectif" in diction.keys()):
|
||||
update_data['objectif'] = str(diction['objectif'])
|
||||
|
||||
|
||||
|
||||
if ("commentaire" in diction.keys()):
|
||||
update_data['commentaire'] = str(diction['commentaire'])
|
||||
|
||||
if ("grp_apprenant_id" in diction.keys() and diction['grp_apprenant_id']):
|
||||
update_data['grp_apprenant_id'] = str(diction['grp_apprenant_id'])
|
||||
grp_apprenant_id = str(diction['grp_apprenant_id'])
|
||||
is_valide_grp_apprenant_id = MYSY_GV.dbname['groupe_inscription'].count_documents(
|
||||
{'_id': ObjectId(str(diction['grp_apprenant_id'])),
|
||||
'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
if (is_valide_grp_apprenant_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du groupe est invalide ")
|
||||
return False, " L'identifiant du groupe est invalide "
|
||||
|
||||
|
||||
if ("ue_id" in diction.keys() and diction['ue_id']):
|
||||
update_data['ue_id'] = str(diction['ue_id'])
|
||||
is_valide_ue_id = MYSY_GV.dbname['unite_enseignement'].count_documents(
|
||||
{'_id': ObjectId(str(diction['ue_id'])),
|
||||
'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
if (is_valide_ue_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'unité d'enseignement est invalide ")
|
||||
return False, " L'identifiant de l'unité d'enseignement est invalide "
|
||||
|
||||
new_unite_enseignement_planif_id = ""
|
||||
if ("ue_id" in diction.keys() and diction['ue_id'] and "ue_planif_line_id" in diction.keys() and diction['ue_planif_line_id']):
|
||||
update_data['unite_enseignement_planif_id'] = str(diction['ue_planif_line_id'])
|
||||
new_unite_enseignement_planif_id = str(diction['ue_planif_line_id'])
|
||||
|
||||
is_valide_unite_enseignement_planif_id = MYSY_GV.dbname['unite_enseignement_planif'].count_documents(
|
||||
{'_id': ObjectId(str(diction['ue_planif_line_id'])),
|
||||
'ue_id':str( diction['ue_id']),
|
||||
'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
if (is_valide_unite_enseignement_planif_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de la ligne de planification de unité d'enseignement est invalide ")
|
||||
return False, " L'identifiant de la ligne de planification de unité d'enseignement est invalide "
|
||||
|
||||
|
||||
|
||||
update_data['session_id'] = str(diction['session_id'])
|
||||
update_data['sequence_start'] = date_debut_seq
|
||||
|
@ -1049,12 +1217,67 @@ def Update_Session_Sequence(diction):
|
|||
update_data['date_update'] = str(datetime.now())
|
||||
update_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
|
||||
print({'_id': ObjectId(str(diction['_id'])),
|
||||
|
||||
'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
|
||||
|
||||
update = MYSY_GV.dbname['session_formation_sequence'].update_one({'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'},
|
||||
'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])},
|
||||
{'$set': update_data}
|
||||
)
|
||||
if (update.modified_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Impossible de mettre à jour la séquence (2); update.modified_count = ", update.modified_count)
|
||||
return False, "Impossible de mettre à jour la séquence (2) "
|
||||
|
||||
|
||||
"""
|
||||
Si la mise à jour fonction et qu'on a bien un update_data['ue_planif_line_id'] = str(diction['ue_planif_line_id'])
|
||||
alors on met à jour la ligne de la collection : unite_enseignement_planif.
|
||||
|
||||
1 - On deprogramme l'ancienne ligne de planification si jamais il eu un mise à jour
|
||||
2 - On programme le nouvelle ligne de planification
|
||||
|
||||
|
||||
"""
|
||||
if( new_unite_enseignement_planif_id != old_unite_enseignement_planif_id ):
|
||||
# Deprogrammation de l'ancien
|
||||
update_data = {}
|
||||
update_data['date_update'] = str(datetime.now())
|
||||
update_data['update_by'] = str(my_partner['_id'])
|
||||
update_data['session_formation_sequence_id'] = ""
|
||||
|
||||
if( old_unite_enseignement_planif_id ):
|
||||
update = MYSY_GV.dbname['unite_enseignement_planif'].update_one({'_id': ObjectId(str(old_unite_enseignement_planif_id)),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'},
|
||||
{'$set': update_data}
|
||||
)
|
||||
|
||||
# Programmation de la nouvelle
|
||||
update_data = {}
|
||||
update_data['date_update'] = str(datetime.now())
|
||||
update_data['update_by'] = str(my_partner['_id'])
|
||||
update_data['session_formation_sequence_id'] = str(diction['_id'])
|
||||
|
||||
update = MYSY_GV.dbname['unite_enseignement_planif'].update_one({'_id': ObjectId(str(new_unite_enseignement_planif_id)),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'},
|
||||
{'$set': update_data}
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
return True, " La séquence a été correctement mise à jour"
|
||||
|
||||
|
@ -1115,6 +1338,16 @@ def Get_Session_Sequence_List(diction):
|
|||
user = New_retVal
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
if( "grp_apprenant_id" not in user.keys() ):
|
||||
user['grp_apprenant_id'] = ""
|
||||
|
||||
if ("ue_id" not in user.keys()):
|
||||
user['ue_id'] = ""
|
||||
|
||||
if ("unite_enseignement_planif_id" not in user.keys()):
|
||||
user['unite_enseignement_planif_id'] = ""
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
@ -1524,7 +1757,7 @@ def Add_Sequence_Affectation_Ressource_Poste(diction):
|
|||
MYSY_GV.dbname['agenda'].insert_one(data_agenda)
|
||||
|
||||
|
||||
return True, " La sequence a bien été affectée au poste"
|
||||
return True, " La ressource a bien été affectée à la sequence"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
@ -2808,6 +3041,7 @@ def Create_Automatic_Sequence_From_Week_Model(diction):
|
|||
|
||||
sequence_data = {}
|
||||
sequence_data['token'] = diction['token']
|
||||
sequence_data['type'] = 'planning'
|
||||
sequence_data['session_id'] = diction['session_id']
|
||||
sequence_data['sequence_title'] = local_event['title']
|
||||
|
||||
|
@ -3154,6 +3388,7 @@ def Create_Automatic_Sequence_From_Month_Model(diction):
|
|||
|
||||
sequence_data = {}
|
||||
sequence_data['token'] = diction['token']
|
||||
sequence_data['type'] = 'planning'
|
||||
sequence_data['session_id'] = diction['session_id']
|
||||
sequence_data['sequence_title'] = local_event['title']
|
||||
|
||||
|
|
|
@ -851,7 +851,11 @@ def Add_Update_Groupe_Inscrit_Membres(diction):
|
|||
new_data['inscription_id'] = str(my_inscription)
|
||||
|
||||
now = str(datetime.now())
|
||||
mytoday = datetime.today()
|
||||
new_data['date_ajout_groupe'] = str(mytoday)
|
||||
|
||||
new_data['date_update'] = now
|
||||
|
||||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
@ -1228,7 +1232,7 @@ def Export_To_Excel_List_Groupe_Membres(diction):
|
|||
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
|
||||
|
||||
tab_exported_fields_header = ["formation", "classe", "Groupe_code","Groupe_Nom", "type_groupe_code", "nom_apprenant",
|
||||
"prenom_apprenant", "email_apprenant", ]
|
||||
"prenom_apprenant", "email_apprenant", "date ajout groupe"]
|
||||
|
||||
|
||||
# Create a workbook and add a worksheet.
|
||||
|
@ -1348,6 +1352,14 @@ def Export_To_Excel_List_Groupe_Membres(diction):
|
|||
worksheet.write(row, column, user['email'])
|
||||
column += 1
|
||||
|
||||
# Champ : date ajout au groupe
|
||||
if( "date_ajout_groupe" in user.keys() ):
|
||||
worksheet.write(row, column, user['date_ajout_groupe'])
|
||||
column += 1
|
||||
else:
|
||||
worksheet.write(row, column, "xxx")
|
||||
column += 1
|
||||
|
||||
|
||||
|
||||
workbook.close()
|
||||
|
@ -1384,7 +1396,8 @@ def Automatic_Creation_Groupe_Member_Inscrit(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'type_groupe_code', 'class_id', 'session_id', 'nb_groupe', 'split_type']
|
||||
field_list = ['token', 'type_groupe_code', 'class_id', 'session_id', 'nb_groupe',
|
||||
'split_type', 'racine']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -1453,30 +1466,34 @@ def Automatic_Creation_Groupe_Member_Inscrit(diction):
|
|||
"""
|
||||
Verifier qu'il y des inscrits valides : On ne prend que les inscriptions validée (status = 1)
|
||||
"""
|
||||
nb_inscrit = 0
|
||||
is_incription_valide = MYSY_GV.dbname['inscription'].count_documents({'session_id':str(diction['session_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'status':'1'})
|
||||
|
||||
nb_inscrit = is_incription_valide
|
||||
"""
|
||||
if( is_incription_valide <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Aucune inscription valide pour cette formation ")
|
||||
return False, " Aucune inscription valide pour cette formation "
|
||||
"""
|
||||
|
||||
"""
|
||||
Mettre les _id des inscrits dans une table
|
||||
"""
|
||||
tab_inscription_id = []
|
||||
for tmp in MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'status': '1'}):
|
||||
tab_inscription_id.append(str(tmp['_id']))
|
||||
if( nb_inscrit > 0 ):
|
||||
for tmp in MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'status': '1'}):
|
||||
tab_inscription_id.append(str(tmp['_id']))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
nb_inscrit = is_incription_valide
|
||||
|
||||
|
||||
"""
|
||||
|
@ -1488,10 +1505,15 @@ def Automatic_Creation_Groupe_Member_Inscrit(diction):
|
|||
curr_dt = datetime.now()
|
||||
suff_curr_timestamp = str(round(curr_dt.timestamp()))[-3:]
|
||||
|
||||
# Ecrasement par la racine si besoin
|
||||
if( "racine" in diction and diction['racine']):
|
||||
suff_curr_timestamp = diction['racine']
|
||||
|
||||
|
||||
while ( cpt < nb_groupe ):
|
||||
cpt = cpt +1
|
||||
local_node = {}
|
||||
local_node['code'] = suff_curr_timestamp+"_Auto_Gr_"+str(cpt)
|
||||
local_node['code'] = suff_curr_timestamp+"_"+str(cpt)
|
||||
local_node['nom'] = suff_curr_timestamp+" Grp_" + str(cpt)
|
||||
local_node['description'] = suff_curr_timestamp+" Description Grp_" + str(cpt)
|
||||
local_node['type_groupe_code'] = str(diction['type_groupe_code'])
|
||||
|
@ -1533,9 +1555,9 @@ def Automatic_Creation_Groupe_Member_Inscrit(diction):
|
|||
del tab_inscription_id[random_val]
|
||||
i = i + 1
|
||||
|
||||
print(" ### les groupes à créer sont : ")
|
||||
#print(" ### les groupes à créer sont : ")
|
||||
for val in global_tab_groupe:
|
||||
print(" ### grp = ", val)
|
||||
#print(" ### grp = ", val)
|
||||
|
||||
## Creation du groupe
|
||||
new_data = {}
|
||||
|
@ -1562,6 +1584,9 @@ def Automatic_Creation_Groupe_Member_Inscrit(diction):
|
|||
new_data['groupe_inscription_id'] = str(inserted_grp_id)
|
||||
new_data['inscription_id'] = str(my_inscription)
|
||||
|
||||
mytoday = datetime.today()
|
||||
new_data['date_ajout_groupe'] = str(mytoday)
|
||||
|
||||
now = str(datetime.now())
|
||||
new_data['date_update'] = now
|
||||
new_data['valide'] = "1"
|
||||
|
@ -1590,3 +1615,319 @@ def Automatic_Creation_Groupe_Member_Inscrit(diction):
|
|||
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 le groupe "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de mettre à jour le split des memebres d'un groupe
|
||||
Par exemple apres le premiers split, il y eu de nouveaux inscrit, on veut les partager
|
||||
oubien l'utilisateur souhaite faire le traitement en 2 temps:
|
||||
1 - create des groupe
|
||||
2 - split des inscrits
|
||||
"""
|
||||
def Automatic_Split_Member_Inscrit_To_Grps(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'class_id', 'session_id', 'split_type', ]
|
||||
|
||||
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', 'session_id', 'split_type', ]
|
||||
|
||||
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
|
||||
|
||||
# Recuperer le nombre de groupe
|
||||
nb_groupe = MYSY_GV.dbname['groupe_inscription'].count_documents({'class_id':str(diction['class_id']),
|
||||
'session_id':str(diction['session_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if(nb_groupe <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Il n'existe aucun groupe valide pour cette classe ")
|
||||
return False, " Il n'existe aucun groupe valide pour cette classe "
|
||||
|
||||
|
||||
"""
|
||||
type de split :
|
||||
- 0 : Ordre Alphabétique par nom d'inscrit
|
||||
- 1 : Aleatoire
|
||||
"""
|
||||
split_type = str(diction['split_type'])
|
||||
if( split_type not in ['0', '1']):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le champ 'groupe par' est incorrecte.")
|
||||
return False, " Le champ 'groupe par' est incorrecte. "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Verifier que la session est valide
|
||||
"""
|
||||
is_session_valide = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(diction['session_id'])),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_session_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de classe est invalide ")
|
||||
return False, " L'identifiant de classe est invalide "
|
||||
|
||||
"""
|
||||
Recuperer le nombre d'inscription qui n'ont pas été encore partagé. Donc des inscriptions qui ne sont pas dans
|
||||
la collection groupe_inscription_membre, pour cette session_id :
|
||||
1 - on recupe les inscriptions deja splité, puis
|
||||
2 - on fait un "not in"
|
||||
"""
|
||||
list_inscription_id_ObjectId_splited_in_grp = []
|
||||
pipe_qry = ([
|
||||
{'$match': {'$and': [{"partner_owner_recid": str(my_partner['recid'])},
|
||||
{"valide": '1', 'session_id':diction['session_id']}
|
||||
]}
|
||||
},
|
||||
{ "$project": {"_id": 1, 'partner_owner_recid':1, }},
|
||||
{'$lookup': {
|
||||
'from': 'groupe_inscription_membre',
|
||||
"let": {"inscription_id": {'$toString': "$_id"},
|
||||
'groupe_inscription_membre_partner_owner_recid': '$partner_owner_recid'},
|
||||
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$inscription_id", '$$inscription_id']},
|
||||
{'$eq': ["$partner_owner_recid",
|
||||
'$$groupe_inscription_membre_partner_owner_recid']},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'collection_groupe_inscription_membre'
|
||||
}
|
||||
},
|
||||
{
|
||||
"$project": {"collection_groupe_inscription_membre._id": 1, 'collection_groupe_inscription_membre.partner_owner_recid':1, "collection_groupe_inscription_membre.inscription_id":1}},
|
||||
{
|
||||
'$unwind': '$collection_groupe_inscription_membre'
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
print(" ### splited : pipe_qry = ", pipe_qry)
|
||||
for retval in MYSY_GV.dbname['inscription'].aggregate(pipe_qry):
|
||||
if( "collection_groupe_inscription_membre" in retval.keys() and "inscription_id" in retval['collection_groupe_inscription_membre'].keys() and retval['collection_groupe_inscription_membre']["inscription_id"]):
|
||||
list_inscription_id_ObjectId_splited_in_grp.append(ObjectId(str(retval['collection_groupe_inscription_membre']["inscription_id"])))
|
||||
|
||||
print(" ### splited : list_inscription_id_ObjectId_splited_in_grp = ", list_inscription_id_ObjectId_splited_in_grp)
|
||||
|
||||
|
||||
nb_inscrit = 0
|
||||
is_incription_valide = MYSY_GV.dbname['inscription'].count_documents({'session_id':str(diction['session_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'status':'1',
|
||||
'_id': { '$nin': list_inscription_id_ObjectId_splited_in_grp}
|
||||
})
|
||||
nb_inscrit = is_incription_valide
|
||||
"""
|
||||
if( is_incription_valide <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Aucune inscription valide pour cette formation ")
|
||||
return False, " Aucune inscription valide pour cette formation "
|
||||
"""
|
||||
|
||||
"""
|
||||
Mettre les _id des inscrits dans une table
|
||||
"""
|
||||
tab_inscription_id = []
|
||||
if( nb_inscrit > 0 ):
|
||||
for tmp in MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'status': '1',
|
||||
'_id': {'$nin': list_inscription_id_ObjectId_splited_in_grp}
|
||||
}):
|
||||
tab_inscription_id.append(str(tmp['_id']))
|
||||
|
||||
|
||||
|
||||
|
||||
print(" #### tab_inscription_id a spliter = ", tab_inscription_id)
|
||||
|
||||
|
||||
"""
|
||||
Creation de la table des groupes
|
||||
"""
|
||||
global_tab_groupe = []
|
||||
cpt = 0
|
||||
"""
|
||||
curr_dt = datetime.now()
|
||||
suff_curr_timestamp = str(round(curr_dt.timestamp()))[-3:]
|
||||
|
||||
# Ecrasement par la racine si besoin
|
||||
if( "racine" in diction and diction['racine']):
|
||||
suff_curr_timestamp = diction['racine']
|
||||
|
||||
|
||||
while ( cpt < nb_groupe ):
|
||||
cpt = cpt +1
|
||||
local_node = {}
|
||||
local_node['code'] = suff_curr_timestamp+"_"+str(cpt)
|
||||
local_node['nom'] = suff_curr_timestamp+" Grp_" + str(cpt)
|
||||
local_node['description'] = suff_curr_timestamp+" Description Grp_" + str(cpt)
|
||||
local_node['type_groupe_code'] = str(diction['type_groupe_code'])
|
||||
local_node['class_id'] = str(diction['class_id'])
|
||||
local_node['session_id'] = str(diction['session_id'])
|
||||
local_node['liste_inscrit'] = []
|
||||
global_tab_groupe.append(local_node)
|
||||
"""
|
||||
|
||||
print({'class_id': str(diction['class_id']),
|
||||
'session_id': str(diction['session_id']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])}
|
||||
)
|
||||
|
||||
global_tab_groupe_tmp = MYSY_GV.dbname['groupe_inscription'].find({'class_id': str(diction['class_id']),
|
||||
'session_id': str(diction['session_id']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
global_tab_groupe = []
|
||||
|
||||
for tmp in global_tab_groupe_tmp:
|
||||
local_tmp = tmp
|
||||
local_tmp['liste_inscrit'] = []
|
||||
global_tab_groupe.append(local_tmp)
|
||||
|
||||
|
||||
|
||||
if( split_type == "0"):
|
||||
# On fait une repartition des participant par Ordre Alphabétique par nom d'inscrit
|
||||
nb_inscrit_par_groupe = (nb_inscrit/nb_groupe)+1 # On met le +1 pour couvrir les eventuels modulo
|
||||
|
||||
while(len(tab_inscription_id) > 0 ):
|
||||
i = 0
|
||||
while( i < nb_groupe and len(tab_inscription_id) > 0):
|
||||
i2 = 0
|
||||
while( i2 < nb_inscrit_par_groupe and len(tab_inscription_id) > 0):
|
||||
i2 = i2 +1
|
||||
global_tab_groupe[i]['liste_inscrit'].append(tab_inscription_id[0])
|
||||
|
||||
del tab_inscription_id[0]
|
||||
i = i + 1
|
||||
|
||||
|
||||
elif( split_type == "1"):
|
||||
# On fait une repartition des participant Aleatoire
|
||||
nb_inscrit_par_groupe = (nb_inscrit / nb_groupe) + 1 # On met le +1 pour couvrir les eventuels modulo
|
||||
|
||||
while (len(tab_inscription_id) > 0):
|
||||
i = 0
|
||||
while (i < nb_groupe and len(tab_inscription_id) > 0):
|
||||
curr_dt = datetime.now()
|
||||
curr_timestamp = int(round(curr_dt.timestamp()))
|
||||
|
||||
random_val = random.randint(0,curr_timestamp )%len(tab_inscription_id)
|
||||
global_tab_groupe[i]['liste_inscrit'].append(tab_inscription_id[random_val])
|
||||
del tab_inscription_id[random_val]
|
||||
i = i + 1
|
||||
|
||||
#print(" ### les groupes à créer sont : ")
|
||||
for val in global_tab_groupe:
|
||||
#print(" ### grp = ", val)
|
||||
"""
|
||||
## Creation du groupe
|
||||
new_data = {}
|
||||
|
||||
new_data['code'] = str(val['code'])
|
||||
new_data['nom'] = str(val['nom'])
|
||||
new_data['description'] = str(val['description'])
|
||||
new_data['type_groupe_code'] = str(diction['type_groupe_code'])
|
||||
new_data['class_id'] = str(diction['class_id'])
|
||||
new_data['session_id'] = str(diction['session_id'])
|
||||
|
||||
|
||||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
inserted_grp_id = MYSY_GV.dbname['groupe_inscription'].insert_one(new_data).inserted_id
|
||||
"""
|
||||
for my_inscription in val['liste_inscrit']:
|
||||
new_data = {}
|
||||
new_data['groupe_inscription_id'] = str(val['_id'])
|
||||
new_data['inscription_id'] = str(my_inscription)
|
||||
|
||||
mytoday = datetime.today()
|
||||
new_data['date_ajout_groupe'] = str(mytoday)
|
||||
|
||||
now = str(datetime.now())
|
||||
new_data['date_update'] = now
|
||||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['groupe_inscription_id'] = str(val['_id'])
|
||||
data_cle['inscription_id'] = str(my_inscription)
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
result = MYSY_GV.dbname['groupe_inscription_membre'].find_one_and_update(
|
||||
data_cle,
|
||||
{"$set": new_data},
|
||||
upsert=True,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
|
||||
return True, " Le groupe a été correctement mis à jour"
|
||||
|
||||
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 le groupe "
|
||||
|
|
13
main.py
13
main.py
|
@ -10590,6 +10590,19 @@ def Automatic_Creation_Groupe_Member_Inscrit():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour partager automatiquement les membres d'une formation (session) en groupe, SANS CREATION de groupe
|
||||
"""
|
||||
@app.route('/myclass/api/Automatic_Split_Member_Inscrit_To_Grps/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Automatic_Split_Member_Inscrit_To_Grps():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Automatic_Split_Member_Inscrit_To_Grps payload = ",payload)
|
||||
status, retval = groupe_inscrit_mgt.Automatic_Split_Member_Inscrit_To_Grps(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API permet d'ajouter / mettre à jour une ligne de planification d'une UE.
|
||||
|
|
|
@ -3503,8 +3503,7 @@ def GetAttendeeDetail_perSession(diction):
|
|||
myprint(str(inspect.stack()[0][3]) + " - Impossible de récupérer les informations de la formation ")
|
||||
return False, " Impossible de récupérer les informations de la formation"
|
||||
|
||||
|
||||
|
||||
my_retrun_dict['class_id'] = local_formation['_id']
|
||||
my_retrun_dict['class_title'] = local_formation['title']
|
||||
|
||||
|
||||
|
|
|
@ -350,6 +350,29 @@ def Get_List_Unite_Enseignement_no_filter(diction):
|
|||
if ("bloc" not in user.keys()):
|
||||
user['bloc'] = ""
|
||||
|
||||
"""
|
||||
Recuperer le nombre de lignes de planification
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
count_nb_planif_lines = MYSY_GV.dbname['unite_enseignement_planif'].count_documents(
|
||||
{'ue_id': str(New_retVal['_id']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
user['planification_line'] = count_nb_planif_lines
|
||||
|
||||
count_nb_planif_lines_uses = MYSY_GV.dbname['unite_enseignement_planif'].count_documents(
|
||||
{'ue_id': str(New_retVal['_id']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'session_formation_sequence_id': {'$exists': True, '$ne': ""}})
|
||||
|
||||
user['planification_used_line'] = count_nb_planif_lines_uses
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
||||
|
@ -448,6 +471,26 @@ def Get_List_Unite_Enseignement_with_filter(diction):
|
|||
if ("bloc" not in user.keys()):
|
||||
user['bloc'] = ""
|
||||
|
||||
"""
|
||||
Recuperer le nombre de lignes de planification
|
||||
"""
|
||||
count_nb_planif_lines = MYSY_GV.dbname['unite_enseignement_planif'].count_documents({'ue_id':str(New_retVal['_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
user['planification_line'] = count_nb_planif_lines
|
||||
|
||||
|
||||
|
||||
count_nb_planif_lines_uses = MYSY_GV.dbname['unite_enseignement_planif'].count_documents(
|
||||
{'ue_id': str(New_retVal['_id']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'session_formation_sequence_id': { '$exists' : True, '$ne': "" }})
|
||||
|
||||
user['planification_used_line'] = count_nb_planif_lines_uses
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
||||
|
@ -858,7 +901,7 @@ def Add_Update_Unite_Enseignement_Planif(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'code', 'titre', 'description', 'objectif', 'prerequis', 'volume_horaire',
|
||||
'ue_id', 'comment', 'unite_enseignement_planif_id']
|
||||
'ue_id', 'comment', 'unite_enseignement_planif_id', 'session_formation_sequence_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -984,7 +1027,9 @@ def Add_Update_Unite_Enseignement_Planif(diction):
|
|||
|
||||
|
||||
"""
|
||||
Supprimer une liste de planification UE
|
||||
Supprimer une liste de planification UE.
|
||||
/!\ : Une regles qui est planifiée ne peut etre supprimé
|
||||
|
||||
"""
|
||||
def Delete_List_Unite_Enseignement_Planif(diction):
|
||||
try:
|
||||
|
@ -1038,6 +1083,19 @@ def Delete_List_Unite_Enseignement_Planif(diction):
|
|||
if( tmp):
|
||||
tab_eu_planif_id_splited_Obj.append(ObjectId(str(tmp)))
|
||||
|
||||
unite_enseignement_planif_data = MYSY_GV.dbname['unite_enseignement_planif'].find_one({'_id':ObjectId(str(tmp)),
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( unite_enseignement_planif_data and "session_formation_sequence_id" in unite_enseignement_planif_data.keys()
|
||||
and unite_enseignement_planif_data['session_formation_sequence_id']):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " La ligne de planification "+str(unite_enseignement_planif_data['code'])+" est actuellement utilisée. Suppression annulée")
|
||||
return False, " La ligne de planification "+str(unite_enseignement_planif_data['code'])+" est actuellement utilisée. Suppression annulée "
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
qery_delete = {'_id': {'$in': tab_eu_planif_id_splited_Obj},
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'locked': '0',
|
||||
|
@ -1500,6 +1558,37 @@ def Get_List_Unite_Enseignement_Planif_lines(diction):
|
|||
for retval in MYSY_GV.dbname['unite_enseignement_planif'].find(find_qry).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
|
||||
local_sequence_title = ""
|
||||
if( "session_formation_sequence_id" not in user.keys() ):
|
||||
user['session_formation_sequence_id'] = ""
|
||||
user['in_use'] = "0"
|
||||
|
||||
if ("session_formation_sequence_id" in user.keys() ):
|
||||
if( user['session_formation_sequence_id'] ):
|
||||
user['in_use'] = "1"
|
||||
|
||||
# Recuperer le titre de la sequence
|
||||
|
||||
|
||||
sequence_data = MYSY_GV.dbname['session_formation_sequence'].find_one(
|
||||
{'_id': ObjectId(str(user['session_formation_sequence_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
if (sequence_data and "sequence_title" in sequence_data.keys() and "session_id" in sequence_data.keys()):
|
||||
session_data = MYSY_GV.dbname['session_formation'].find_one({'_id':ObjectId(str(sequence_data['session_id'])),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if(session_data and "code_session" in session_data.keys() and "sequence_title" in sequence_data.keys()):
|
||||
local_sequence_title = session_data['code_session'] +" - "+sequence_data['sequence_title']
|
||||
|
||||
|
||||
else:
|
||||
user['in_use'] = "0"
|
||||
|
||||
user['used_sequence_title'] = local_sequence_title
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
@ -1577,6 +1666,30 @@ def Get_Given_Unite_Enseignement_Planif_Data(diction):
|
|||
for retval in MYSY_GV.dbname['unite_enseignement_planif'].find(find_qry).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
|
||||
local_sequence_title = ""
|
||||
if ("session_formation_sequence_id" not in user.keys()):
|
||||
user['session_formation_sequence_id'] = ""
|
||||
user['in_use'] = "0"
|
||||
|
||||
if ("session_formation_sequence_id" in user.keys()):
|
||||
if (user['session_formation_sequence_id']):
|
||||
user['in_use'] = "1"
|
||||
|
||||
# Recuperer le titre de la sequence
|
||||
sequence_data = MYSY_GV.dbname['session_formation_sequence'].find_one({'_id':str(user['session_formation_sequence_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
if( sequence_data and "sequence_title" in sequence_data.keys() ):
|
||||
local_sequence_title = sequence_data['sequence_data']
|
||||
|
||||
|
||||
else:
|
||||
user['in_use'] = "0"
|
||||
|
||||
user['used_sequence_title'] = local_sequence_title
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
|
Loading…
Reference in New Issue