01/06/2026 - 22h00

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-06-01 22:31:17 +02:00
parent 518966d471
commit 213cd923d9
6 changed files with 3546 additions and 37 deletions

View File

@ -4,12 +4,12 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="30/05/2026 - 21h00">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="31/05/2026 - 17h00">
<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$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" 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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/domaine_competence_pedagogique.py" beforeDir="false" afterPath="$PROJECT_DIR$/domaine_competence_pedagogique.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -454,7 +454,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="594" />
<option name="localTasksCounter" value="595" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -496,7 +496,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="28/04/26 - 19h" />
<MESSAGE value="29/04/26 - 21h" />
<MESSAGE value="04/05/2026 - 13h" />
<MESSAGE value="04/05/2026 - 19h" />
@ -521,6 +520,7 @@
<MESSAGE value="27/05/2026 - 22h00" />
<MESSAGE value="28/05/2026 - 22h00" />
<MESSAGE value="30/05/2026 - 21h00" />
<option name="LAST_COMMIT_MESSAGE" value="30/05/2026 - 21h00" />
<MESSAGE value="31/05/2026 - 17h00" />
<option name="LAST_COMMIT_MESSAGE" value="31/05/2026 - 17h00" />
</component>
</project>

View File

@ -19953,7 +19953,7 @@ def Get_Inscrit_List_Sequence_Formation_For_Given_Session(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'session_id', 'tab_inscrit_ids']
field_list = ['token', 'session_id', 'tab_inscrit_ids', 'tab_domaine_competence_ids']
incom_keys = diction.keys()
for val in incom_keys:
@ -19995,6 +19995,24 @@ def Get_Inscrit_List_Sequence_Formation_For_Given_Session(diction):
str(inspect.stack()[0][3]) + " La session_id :" + str(diction['session_id']) + " est invalide ")
return False, " L'identifiant de la session :" + str(diction['session_id']) + " est invalide "
filt_domaine_competence = {}
tab_domaine_competence_ids = []
if( "tab_domaine_competence_ids" in diction.keys() and diction['tab_domaine_competence_ids']):
tab_domaine_competence_ids_work = str(diction['tab_domaine_competence_ids']).split(',')
for domaine_competence_id in tab_domaine_competence_ids_work:
if (domaine_competence_id):
if (MYSY_GV.dbname['domaine_competence_pedagogique'].count_documents({'_id': ObjectId(str(domaine_competence_id)),
'valide': '1',
'partner_owner_recid': str(
my_partner['recid'])}) != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le domaine de compétenec " + str(domaine_competence_id) + " est invalide ")
return False, " Le domaine de compétenec " + str(domaine_competence_id) + " est invalide "
tab_domaine_competence_ids.append(str(domaine_competence_id))
tab_inscrit_ids = []
tab_inscrit_ids_work = str(diction['tab_inscrit_ids']).split(',')
for inscrit_id in tab_inscrit_ids_work:
@ -20036,8 +20054,13 @@ def Get_Inscrit_List_Sequence_Formation_For_Given_Session(diction):
query['valide'] = "1"
query['locked'] = "0"
if (len(tab_domaine_competence_ids) > 0):
query['domaine_competence_id'] = {'$in': tab_domaine_competence_ids}
#print(" ### query = ", query)
for retval in MYSY_GV.dbname['session_formation_sequence'].find(query).sort("sequence_start", 1):
#print(" retval === ", retval)
print(" retval === ", retval)
user = {}
user['id'] = str(val_tmp)
user['_id'] = str(retval['_id'])
@ -20053,6 +20076,7 @@ def Get_Inscrit_List_Sequence_Formation_For_Given_Session(diction):
user['domaine_competence_id'] = retval['domaine_competence_id']
domaine_competence_id_code = ""
if( retval['domaine_competence_id'] ):
bc_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one({'_id':ObjectId(str( retval['domaine_competence_id'])),
'partner_owner_recid': str(my_partner['recid'])}, {'code':1})
@ -20063,8 +20087,10 @@ def Get_Inscrit_List_Sequence_Formation_For_Given_Session(diction):
user['domaine_competence_id_code'] = str(domaine_competence_id_code)
user['obligatoire'] = retval['obligatoire']
user['tab_grp_apprenant_ids_id'] = str(retval['tab_grp_apprenant_ids']['_id'])
user['tab_grp_apprenant_ids_code'] = str(retval['tab_grp_apprenant_ids']['code'])
if( "tab_grp_apprenant_ids" in retval.keys() ):
user['tab_grp_apprenant_ids'] = retval['tab_grp_apprenant_ids']
else:
user['tab_grp_apprenant_ids'] = []
RetObject.append(mycommon.JSONEncoder().encode(user))
@ -20091,7 +20117,8 @@ def Create_Inscrit_Absence_By_Plage_Of_Date_OR_Sequence_Id(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'session_id', 'tab_inscrit_ids', 'start_date', 'end_date', 'sequence_id', 'justified']
field_list = ['token', 'session_id', 'tab_inscrit_ids', 'start_date', 'end_date', 'sequence_id', 'justified',
'comment']
incom_keys = diction.keys()
for val in incom_keys:
@ -20278,10 +20305,10 @@ def Create_Inscrit_Absence_By_Plage_Of_Date_OR_Sequence_Id(diction):
{
"$match": {
"sequence_start_date": {
"$gt": datetime.strptime(date_debut_seq, "%d/%m/%Y %H:%M")
"$gte": datetime.strptime(date_debut_seq, "%d/%m/%Y %H:%M")
},
"sequence_end_date": {
"$lt": datetime.strptime(date_fin_seq, "%d/%m/%Y %H:%M")
"$lte": datetime.strptime(date_fin_seq, "%d/%m/%Y %H:%M")
}
}
},
@ -20308,13 +20335,14 @@ def Create_Inscrit_Absence_By_Plage_Of_Date_OR_Sequence_Id(diction):
}
]
#print(" QRYYY = ",query)
print(" QRYYY = ",query)
for retval in MYSY_GV.dbname["session_formation_sequence"].aggregate(query) :
#print(' CREATION ABSENCE SUR ', retval)
print(' CREATION ABSENCE SUR ', retval)
absence_data_to_add = {}
absence_data_to_add['related_collection'] = "apprenant"
absence_data_to_add['related_collection_email'] = inscrit_data['email']
absence_data_to_add['inscription_id'] = str(inscrit)
absence_data_to_add['event_title'] = "Abs : "+str(retval['sequence_title'])
start_date = datetime.strptime(str(retval['sequence_start']), "%d/%m/%Y %H:%M")
@ -20335,12 +20363,31 @@ def Create_Inscrit_Absence_By_Plage_Of_Date_OR_Sequence_Id(diction):
else:
absence_data_to_add['justified'] = "false"
if ("comment" in diction.keys() ):
absence_data_to_add['comment'] = str(diction['comment'])
else:
absence_data_to_add['justified'] = ""
absence_data_to_add['partner_owner_recid'] = str(my_partner['recid'])
absence_data_to_add['valide'] = "1"
absence_data_to_add['locked'] = "0"
#print(" absence_data_to_add = ", absence_data_to_add)
insert = MYSY_GV.dbname['agenda'].insert_one(absence_data_to_add)
data_key = {}
data_key['related_collection'] = "inscription"
data_key['event_type'] = "absence"
data_key['event_start'] = absence_data_to_add['event_start']
data_key['event_end'] = absence_data_to_add['event_end']
data_key['session_id'] = absence_data_to_add['session_id']
data_key['domaine_competence_id'] = absence_data_to_add['domaine_competence_id']
data_key['ue_id'] = absence_data_to_add['ue_id']
ret_val = MYSY_GV.dbname['agenda'].find_one_and_update(
data_key,
{"$set": absence_data_to_add},
upsert=True,
return_document=ReturnDocument.AFTER
)
cpt = cpt +1
@ -20352,3 +20399,198 @@ def Create_Inscrit_Absence_By_Plage_Of_Date_OR_Sequence_Id(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 créer la ou les absences "
"""
Cette fonction retourn le pourcentage d'absence par BC pour un inscrit, par rapport un domaine de compétence donné
"""
def Get_Inscrit_Absence_Pourcentage_By_BC_For_Given_Session(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'session_id', 'tab_inscrit_ids', 'tab_domaine_competence_ids']
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', 'session_id', 'tab_inscrit_ids']
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans 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é de la session
if (MYSY_GV.dbname['session_formation'].count_documents({'_id': ObjectId(str(diction['session_id'])),
'valide': '1',
'partner_owner_recid': str(
my_partner['recid'])}) != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " La session_id :" + str(diction['session_id']) + " est invalide ")
return False, " L'identifiant de la session :" + str(diction['session_id']) + " est invalide "
filt_domaine_competence = {}
tab_domaine_competence_ids = []
if( "tab_domaine_competence_ids" in diction.keys() and diction['tab_domaine_competence_ids']):
tab_domaine_competence_ids_work = str(diction['tab_domaine_competence_ids']).split(',')
for domaine_competence_id in tab_domaine_competence_ids_work:
if (domaine_competence_id):
if (MYSY_GV.dbname['domaine_competence_pedagogique'].count_documents({'_id': ObjectId(str(domaine_competence_id)),
'valide': '1',
'nb_heure': {
'$exists': True,
'$ne': ""},
'partner_owner_recid': str(
my_partner['recid'])}) != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le domaine de compétenec " + str(domaine_competence_id) + " est invalide ")
return False, " Le domaine de compétenec " + str(domaine_competence_id) + " est invalide "
tab_domaine_competence_ids.append(str(domaine_competence_id))
tab_inscrit_ids = []
tab_inscrit_ids_work = str(diction['tab_inscrit_ids']).split(',')
for inscrit_id in tab_inscrit_ids_work:
if (inscrit_id):
if (MYSY_GV.dbname['inscription'].count_documents({'_id': ObjectId(str(inscrit_id)),
'valide': '1',
'partner_owner_recid': str(
my_partner['recid'])}) != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'inscription " + str(inscrit_id) + " est invalide ")
return False, " L'inscription " + str(inscrit_id) + " est invalide "
tab_inscrit_ids.append(str(inscrit_id))
RetObject = []
for my_inscrit in tab_inscrit_ids :
node_inscrit = {}
node_inscrit['inscription_id'] = str(my_inscrit)
node_inscrit['tab_absence'] = []
for my_domaine_competence_id in tab_domaine_competence_ids :
node_absence = {}
node_absence['domaine_competence_id'] = str(my_domaine_competence_id)
"""
Recuprer le volume horaire du domaine de compétence
"""
my_domaine_competence_total_heure = 0
my_domaine_competence_seuil_absence = -1
my_domaine_competence_id_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one(
{'_id': ObjectId(str(my_domaine_competence_id)),
'valide': '1',
'partner_owner_recid': str(
my_partner['recid'])}, {'nb_heure':1, 'code':1, 'seuil_absence':1})
if( my_domaine_competence_id_data and "nb_heure" in my_domaine_competence_id_data.keys() and my_domaine_competence_id_data['nb_heure']):
my_domaine_competence_total_heure = mycommon.tryFloat(my_domaine_competence_id_data['nb_heure'])
if( my_domaine_competence_total_heure <= 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " La configuration du volume horaire du BC" + str(my_domaine_competence_id) + " est invalide ")
return False, "La configuration du volume horaire du BC" + str(my_domaine_competence_id) + " est invalide "
if (my_domaine_competence_id_data and "seuil_absence" in my_domaine_competence_id_data.keys() and
my_domaine_competence_id_data['seuil_absence']):
my_domaine_competence_seuil_absence = mycommon.tryFloat(my_domaine_competence_id_data['seuil_absence'])
RetObject = []
val_tmp = 0
query = {}
query['inscription_id'] = str(my_inscrit)
query['partner_owner_recid'] = str(my_partner["recid"])
query['event_type'] = "absence"
query['valide'] = "1"
query['locked'] = "0"
query['domaine_competence_id'] = str(my_domaine_competence_id)
#print(" ### query = ", query)
total_heure_absence = 0
total_heure_absence_justifie = 0
total_heure_absence_non_justifie = 0
for New_retVal in MYSY_GV.dbname['agenda'].find(query):
print(" retval === ", New_retVal)
a = datetime.fromisoformat(New_retVal['event_start'])
b = datetime.fromisoformat(New_retVal['event_end'])
total = (b - a)
total_heure_absence = total_heure_absence + total.total_seconds() / 3600
if ("justified" in New_retVal.keys() and New_retVal['justified'] == "true"):
total_heure_absence_justifie = total_heure_absence_justifie + total.total_seconds() / 3600
else:
total_heure_absence_non_justifie = total_heure_absence_non_justifie + total.total_seconds() / 3600
total_heure_absence = mycommon.tryFloat(round(total_heure_absence, 2))
total_heure_absence_justifie = mycommon.tryFloat(round(total_heure_absence_justifie, 2))
total_heure_absence_non_justifie = mycommon.tryFloat(round(total_heure_absence_non_justifie, 2))
print(" DOMAINE COMPETENCE ==== ", my_domaine_competence_id_data['code'])
print(" \t## my_domaine_competence_total_heure = ", my_domaine_competence_total_heure)
print(" \t## total_heure_absence = ", total_heure_absence)
print(" \t## total_heure_absence_justifie = ", total_heure_absence_justifie)
print(" \t## total_heure_absence_non_justifie = ", total_heure_absence_non_justifie)
pourcentage_absence_non_justifed = 100
if( my_domaine_competence_total_heure > 0 ):
pourcentage = (total_heure_absence_non_justifie / my_domaine_competence_total_heure)*100
pourcentage_absence_non_justifed = mycommon.tryFloat( round(pourcentage, 2))
print(" \t## pourcentage_absence_non_justifed = ", pourcentage_absence_non_justifed)
if( my_domaine_competence_seuil_absence > 0 and my_domaine_competence_seuil_absence < pourcentage_absence_non_justifed ):
print(" \t## pourcentage_absence_non_justifed DEPACE LE POURCENTAGE AUTORISE QUI EST DE ", my_domaine_competence_seuil_absence)
node_absence['absence_deplace_seuil'] = "1"
else:
node_absence['absence_deplace_seuil'] = ""
node_absence['domaine_competence_total_heure'] = str(my_domaine_competence_total_heure)
node_absence['domaine_competence_seuil_absence'] = str(my_domaine_competence_seuil_absence)
node_absence['total_heure_absence'] = str(total_heure_absence)
node_absence['total_heure_absence_non_justifie'] = str(total_heure_absence_non_justifie)
node_absence['pourcentage_absence_non_justifed'] = str(pourcentage_absence_non_justifed)
node_inscrit['tab_absence'].append(node_absence)
RetObject.append(mycommon.JSONEncoder().encode(node_inscrit))
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) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de calculer les pourcentage d'absence "

File diff suppressed because it is too large Load Diff

View File

@ -306,7 +306,7 @@ def Add_Update_Agenda_Event_Stagiaire(diction):
une fois que le module 'apprenant' est ok, alors on pourra tout basculer sur l'apprenant et travailler avec l'_id
"""
if( str(str(diction['related_collection'])) == "inscription" and "inscription_id" in diction.keys()) :
is_existe_valide_related_collection_recid = MYSY_GV.dbname[str(diction['related_collection'])].count_documents({'email':str(diction['related_collection_email']),
is_existe_valide_related_collection_recid = MYSY_GV.dbname[str(diction['related_collection'])].count_documents({
'partner_owner_recid':str(my_partner['recid']),
'status':'1',
'_id':ObjectId(str(diction['inscription_id']))
@ -637,7 +637,7 @@ def get_Agenda_Event_List_Stagiaire(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'related_collection', 'related_collection_email']
field_list = ['token', 'related_collection', 'related_collection_email', 'inscription_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -649,7 +649,7 @@ def get_Agenda_Event_List_Stagiaire(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'related_collection', 'related_collection_email']
field_list_obligatoire = ['token', ]
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
@ -675,8 +675,18 @@ def get_Agenda_Event_List_Stagiaire(diction):
total_heure_absence = 0
for New_retVal in MYSY_GV.dbname['agenda'].find({'related_collection':str(diction['related_collection']), 'related_collection_email':str(diction['related_collection_email']),
'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'}):
qry = ""
if( 'inscription_id' in diction.keys() and diction['inscription_id']):
qry = {'inscription_id':str(diction['inscription_id']),
'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'}
elif("related_collection" in diction.keys() and diction['related_collection'] and "related_collection_email" in diction.keys() and diction['related_collection_email'] ):
qry = {'related_collection':str(diction['related_collection']), 'related_collection_email':str(diction['related_collection_email']),
'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'}
for New_retVal in MYSY_GV.dbname['agenda'].find(qry):
user = New_retVal
@ -725,7 +735,7 @@ def get_Agenda_Event_List_Stagiaire_Total_Nb_Heure(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'related_collection', 'related_collection_email']
field_list = ['token', 'related_collection', 'related_collection_email', 'inscription_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -737,7 +747,7 @@ def get_Agenda_Event_List_Stagiaire_Total_Nb_Heure(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'related_collection', 'related_collection_email']
field_list_obligatoire = ['token', ]
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
@ -764,8 +774,21 @@ def get_Agenda_Event_List_Stagiaire_Total_Nb_Heure(diction):
total_heure_absence_justifie = 0
total_heure_absence_non_justifie = 0
for New_retVal in MYSY_GV.dbname['agenda'].find({'related_collection':str(diction['related_collection']), 'related_collection_email':str(diction['related_collection_email']),
'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'}):
qry = ""
if ('inscription_id' in diction.keys() and diction['inscription_id']):
qry = {'inscription_id': str(diction['inscription_id']),
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'}
elif ("related_collection" in diction.keys() and diction[
'related_collection'] and "related_collection_email" in diction.keys() and diction[
'related_collection_email']):
qry = {'related_collection': str(diction['related_collection']),
'related_collection_email': str(diction['related_collection_email']),
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'}
for New_retVal in MYSY_GV.dbname['agenda'].find(qry):
user = New_retVal
@ -780,9 +803,9 @@ def get_Agenda_Event_List_Stagiaire_Total_Nb_Heure(diction):
else:
total_heure_absence_non_justifie = total_heure_absence_non_justifie + total.total_seconds() / 3600
total_heure_absence = round(total_heure_absence, 2)
total_heure_absence_justifie = round(total_heure_absence_justifie, 2)
total_heure_absence_non_justifie = round(total_heure_absence_non_justifie, 2)
total_heure_absence = mycommon.tryFloat(round(total_heure_absence, 2))
total_heure_absence_justifie = mycommon.tryFloat(round(total_heure_absence_justifie, 2))
total_heure_absence_non_justifie = mycommon.tryFloat(round(total_heure_absence_non_justifie, 2))
node_total_absence = {'total_heure':str(total_heure_absence), 'total_heure_absence_justifie':str(total_heure_absence_justifie),
'total_heure_absence_non_justifie':str(total_heure_absence_non_justifie)}

View File

@ -52,7 +52,7 @@ def Add_domaine_competence_pedagogique(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'description', 'commentaire', 'code', 'couleur'
field_list = ['token', 'description', 'commentaire', 'code', 'couleur', 'nb_heure', 'seuil_absence'
]
incom_keys = diction.keys()
@ -65,7 +65,7 @@ def Add_domaine_competence_pedagogique(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'code' ]
field_list_obligatoire = ['token', 'code' , 'nb_heure']
for val in field_list_obligatoire:
if val not in diction:
@ -83,8 +83,6 @@ def Add_domaine_competence_pedagogique(diction):
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
@ -103,6 +101,23 @@ def Add_domaine_competence_pedagogique(diction):
return False, " Le code "+str(diction['code'])+" est déjà utilisé "
local_status, local_retval = mycommon.IsFloat(diction['nb_heure'])
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le volume horaire est invalide ")
return False, "Le volume horaire est invalide "
if( "seuil_absence" in diction.keys() and diction['seuil_absence']):
local_status, local_retval = mycommon.IsFloat(diction['seuil_absence'])
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le seuil d'absence autorisé est invalide ")
return False, "Le seuil d'absence autorisé est invalide "
mydata = {}
mydata = diction
@ -123,6 +138,9 @@ def Add_domaine_competence_pedagogique(diction):
if ("couleur" not in mydata.keys()):
mydata['couleur'] = "#3573CB"
if ("seuil_absence" not in mydata.keys()):
mydata['seuil_absence'] = ""
inserted_id = MYSY_GV.dbname['domaine_competence_pedagogique'].insert_one(mydata).inserted_id
if (not inserted_id):
@ -148,9 +166,8 @@ def Update_domaine_competence_pedagogique(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'description', 'domaine_competence_pedagogique_id', 'commentaire', 'code', 'couleur'
]
field_list = ['token', 'description', 'domaine_competence_pedagogique_id', 'commentaire', 'code', 'couleur',
'nb_heure', 'seuil_absence']
incom_keys = diction.keys()
for val in incom_keys:
@ -162,7 +179,7 @@ def Update_domaine_competence_pedagogique(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'domaine_competence_pedagogique_id', 'code']
field_list_obligatoire = ['token', 'domaine_competence_pedagogique_id', 'code', 'nb_heure']
for val in field_list_obligatoire:
if val not in diction:
@ -214,6 +231,22 @@ def Update_domaine_competence_pedagogique(diction):
str(inspect.stack()[0][3]) + " L'identifiant du domaine de compétence est invalide ")
return False, " L'identifiant du domaine de compétence est invalide "
local_status, local_retval = mycommon.IsFloat(diction['nb_heure'])
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le volume horaire est invalide ")
return False, "Le volume horaire est invalide "
if ("seuil_absence" in diction.keys() and diction['seuil_absence']):
local_status, local_retval = mycommon.IsFloat(diction['seuil_absence'])
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le seuil d'absence autorisé est invalide ")
return False, "Le seuil d'absence autorisé est invalide "
mydata = {}
mydata = diction
@ -308,6 +341,14 @@ def Get_domaine_competence_pedagogique_no_filter(diction):
if ("couleur" not in user.keys()):
user['couleur'] = "#3573CB"
if ("nb_heure" not in user.keys()):
user['nb_heure'] = "1"
if ("seuil_absence" not in user.keys()):
user['seuil_absence'] = ""
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
@ -393,6 +434,13 @@ def Get_Given_domaine_competence_pedagogique(diction):
if ("couleur" not in user.keys()):
user['couleur'] = "#3573CB"
if ("nb_heure" not in user.keys()):
user['nb_heure'] = "1"
if ("seuil_absence" not in user.keys()):
user['seuil_absence'] = ""
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1

15
main.py
View File

@ -12936,6 +12936,21 @@ def Create_Inscrit_Absence_By_Plage_Of_Date_OR_Sequence_Id():
"""
API permet le pourcentage d'absence non justifié pour un inscrit par rapport à un domaine de compétence donnée
"""
@app.route('/myclass/api/Get_Inscrit_Absence_Pourcentage_By_BC_For_Given_Session/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Inscrit_Absence_Pourcentage_By_BC_For_Given_Session():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Inscrit_Absence_Pourcentage_By_BC_For_Given_Session payload = ",payload)
status, retval = inscription.Get_Inscrit_Absence_Pourcentage_By_BC_For_Given_Session(payload)
return jsonify(status=status, message=retval)
"""
API qui recuperer les reponses d'un survey donné dans une fichier pdf
"""