06/06/2026 - 21h

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-06-06 20:55:21 +02:00
parent 213cd923d9
commit 030565df79
7 changed files with 11797 additions and 87 deletions

View File

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

View File

@ -1040,7 +1040,7 @@ def AddStagiairetoClass(diction):
new_apprenant_diction = diction
champ_to_delete = ['class_internal_url', 'session_id', 'inscription_validation_date', 'apprenant_id',
'status', 'modefinancement', 'type_apprenant', 'financeur_rattachement_id',
'quotation_id', 'facture_client_rattachement_id', 'price']
'quotation_id', 'facture_client_rattachement_id', 'price', 'modefinancement_id']
for val in champ_to_delete:
if (val in new_apprenant_diction.keys()):
@ -20594,3 +20594,197 @@ def Get_Inscrit_Absence_Pourcentage_By_BC_For_Given_Session(diction):
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de calculer les pourcentage d'absence "
"""
fonction interne identique à la précedente : Get_Inscrit_Absence_Pourcentage_By_BC_For_Given_Session
"""
def Internal_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(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, " Internal Impossible de calculer les pourcentage d'absence "

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,7 @@
Ce fichier gere les sessions de formation
"""
import ast
import random
import smtplib
from email import encoders
from email.mime.base import MIMEBase
@ -723,12 +724,15 @@ def Add_Update_SessionFormation(diction):
# il faut créer le groupe de type promo qui va contenir tous les apprenant de la promo
promo_code = ""
promo_nom = ""
if( is_class_data and "external_code" in is_class_data.keys()):
promo_code = "Grp_Promo_"+str(is_class_data['external_code'])[0:10]
promo_nom = "Grp Promo "+str(is_class_data['external_code'])[0:10]
if( "code_session" in diction.keys() and diction['code_session'] ):
result = re.sub(r"[^a-zA-Z0-9]", "", diction['code_session'])
new_groupe_code = result+"_"+str(random.randint(10, 99))
promo_code = "Grp_Promo_"+str(new_groupe_code)
promo_nom = "Grp Promo "+str(new_groupe_code)[0:10]
else:
promo_code = "Grp_Promotion"
promo_nom = "Grp Promotion"
new_groupe_code = str( random.randint(10000, 99999))
promo_code = "Grp_Promo_" + str(new_groupe_code)
promo_nom = "Grp Promo " + str(new_groupe_code)[0:10]
groupe_inscription_type_promo_data = MYSY_GV.dbname['groupe_inscription_type'].find_one(
{'is_promotion_grp': '1',

View File

@ -43,6 +43,7 @@ from datetime import datetime, date
from xhtml2pdf import pisa
import Inscription_mgt
import module_editique
import prj_common as mycommon
import secrets
@ -3153,12 +3154,26 @@ def Cacul_Session_Note_Finale_For_calcul_Stanard(diction):
"""
Cette fonction permet d'imprimer le bulleting
Cette fonction permet d'imprimer le bulletin scolaire
d'un appernant (bulletin de note)
"""
def Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF(diction):
try:
field_list_obligatoire = ['token', 'tab_inscrit_ids']
"""
Verification des input acceptés
"""
field_list = ['token', 'tab_inscrit_ids', 'tab_semestre', 'diplome_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"
field_list_obligatoire = ['token', 'tab_inscrit_ids', 'diplome_id']
for val in field_list_obligatoire:
if val not in diction:
@ -3236,8 +3251,19 @@ def Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF(diction):
local_node['session_id'] = str(inscription_data['session_id'])
local_node['class_id'] = str(inscription_data['class_id'])
if( "tab_semestre" in diction.keys() and diction['tab_semestre']):
local_node['tab_semestre'] = str(diction['tab_semestre'])
local_node['diplome_id'] = str(diction['diplome_id'])
print(" #### Traitemnt de local_diction rrr = ", local_node)
local_status, local_full_file_name = Create_Bulletin_By_Inscrit_PDF(local_node)
#local_status, local_full_file_name = Create_Bulletin_By_Inscrit_PDF(local_node)
"""
New version
"""
local_status, local_full_file_name = Create_Bulletin_By_Inscrit_PDF_V2_Work_Collection(local_node)
if (local_status is False):
return local_status, local_full_file_name
else:
@ -3543,6 +3569,274 @@ def Create_Bulletin_By_Inscrit_PDF(diction):
return False, " Impossible de créer le fichier pdf Create_Bulletin_By_Inscrit_PDF "
"""
Nouvelle version de la creation du bulletin scolaire en aller chercher les note,
et les semestre dans la collection : work_calcul_moyenne_by_ue_bc_diplome_session_semestre
Important : Concernant le semestre, on va donner la possibilité d'editer un bullettin pour
plusieurs semestre (par exmple cas d'un bulleting annuel)
"""
def Create_Bulletin_By_Inscrit_PDF_V2_Work_Collection(diction):
try:
"""
Verification des input acceptés
"""
field_list = ['token', 'courrier_template_id', 'inscription_id', 'class_id', 'session_id',
'tab_semestre', 'diplome_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"
field_list_obligatoire = ['token', 'courrier_template_id', 'inscription_id', 'class_id', 'session_id',
'diplome_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, " La valeur '" + val + "' n'est pas presente dans la liste des arguments"
my_token = ""
if ("token" in diction.keys()):
if diction['token']:
my_token = diction['token']
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
tab_semestre = []
if( "tab_semestre" in diction.keys() and diction['tab_semestre']):
tab_semestre_work = str(diction['tab_semestre']).split(',')
for tmp in tab_semestre_work:
if( tmp ):
tab_semestre.append(str(tmp).strip())
print(" ### QRY = ", {'_id': ObjectId(str(diction['courrier_template_id'])),
'valide': '1',
'locked': '0',
'ref_interne': 'INSCRIT_BULLETIN_NOTE',
'partner_owner_recid': str(my_partner['recid'])})
# 1 - Verifier que le modele de courrier est bien editable par individu
template_courrier_data = MYSY_GV.dbname['courrier_template'].find_one(
{'_id': ObjectId(str(diction['courrier_template_id'])),
'valide': '1',
'locked': '0',
'ref_interne': 'INSCRIT_BULLETIN_NOTE',
'partner_owner_recid': str(my_partner['recid'])})
if (template_courrier_data is None):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant du modèle de document " + str(
diction['courrier_template_id']) + " est invalide")
return False, " L'identifiant du modèle de document " + str(
diction['courrier_template_id']) + " est invalide "
if ("edit_by_client" in template_courrier_data.keys() and str(template_courrier_data['edit_by_client']) == "1"):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le modèle de courrier n'est pas éditable par stagiaire. ")
return False, " Le modèle de courrier n'est pas éditable par stagiaire "
statgiaire_data = MYSY_GV.dbname['inscription'].find_one(
{'_id': ObjectId(str(diction['inscription_id'])), 'status': '1',
'partner_owner_recid': str(my_partner['recid'])})
tab_stagiaire = []
tab_stagiaire.append(statgiaire_data['_id'])
"""
update du 30/01/2024
si le participant à un apprenant_id, alors on recupere la valeur de l'apprenant id. On doit travailler sur cette dernier.
En general, avant d'envoyer une convocation ou convention, l'inscription est validée et donc le dossier apprenant existe.
Du coup si tout se passe bien, dans cette fonction, on travaillera tjrs avec l'apprenant_id
"""
tab_apprenant = []
if ("apprenant_id" in statgiaire_data.keys() and statgiaire_data['apprenant_id']):
tab_apprenant.append(ObjectId(str(statgiaire_data['apprenant_id'])))
# Recuperer les notes des UE dans la collection 'work_calcul_moyenne_by_ue_bc_diplome_session_semestre'
session_formation_final_note_classement_data = []
qyr_data = {'inscrit_id': str(diction['inscription_id']),
'valide': '1', 'partner_owner_recid': str(my_partner['recid']),
'diplome_id':str(diction['diplome_id']), }
if( len(tab_semestre) > 0 ):
qyr_data = {'inscrit_id': str(diction['inscription_id']),
'valide': '1', 'partner_owner_recid': str(my_partner['recid']),
'diplome_id': str(diction['diplome_id']), 'semestre':{'$in':tab_semestre_work}}
print(" ## QRY work_calcul_moyenne_by_ue_bc_diplome_session_semestre = ", qyr_data)
for note_classement_data in MYSY_GV.dbname['work_calcul_moyenne_by_ue_bc_diplome_session_semestre'].find(qyr_data).sort({'domaine_competence_id':1}):
local_node = {}
local_node = note_classement_data
if ("ue_id" in note_classement_data.keys() and note_classement_data['ue_id']):
ue_id_data = MYSY_GV.dbname['unite_enseignement'].find_one(
{'_id': ObjectId(note_classement_data['ue_id']),
'partner_owner_recid': my_partner['recid']}, {'_id': 1, 'code': 1, 'titre': 1})
if (ue_id_data):
local_node['ue_id_data'] = ue_id_data
else:
local_node['ue_id_data'] = {}
if ("diplome_id" in note_classement_data.keys() and note_classement_data['diplome_id']):
diplome_id_data = MYSY_GV.dbname['diplome'].find_one(
{'_id': ObjectId(note_classement_data['diplome_id']),
'partner_owner_recid': my_partner['recid']}, {'_id': 1, 'code': 1, 'description': 1})
if (diplome_id_data):
local_node['diplome_id_data'] = diplome_id_data
else:
local_node['diplome_id_data'] = {}
session_formation_final_note_classement_data.append(local_node)
print(" ### session_formation_final_note_classement_data = ",session_formation_final_note_classement_data )
tab_session = []
tab_session.append(ObjectId(diction['session_id']))
tab_class = []
tab_class.append(ObjectId(diction['class_id']))
# Creation du dictionnaire d'information à utiliser pour la creation du doc
convention_dictionnary_data = {}
new_diction = {}
new_diction['token'] = diction['token']
new_diction['list_stagiaire_id'] = tab_stagiaire
new_diction['list_session_id'] = tab_session
new_diction['list_class_id'] = tab_class
new_diction['list_client_id'] = []
new_diction['list_apprenant_id'] = tab_apprenant
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
if (local_status is False):
return local_status, local_retval
convention_dictionnary_data = local_retval
convention_dictionnary_data[
'session_formation_final_note_classement'] = session_formation_final_note_classement_data
convention_dictionnary_data['full_statgiaire_data'] = statgiaire_data
body = {
"params": convention_dictionnary_data,
}
"""
Creation du ficier PDF
"""
header_html = """<html>
<head>
<style>
@page {
size: a4 portrait;
@frame content_frame { /* Content Frame */
left: 50pt; width: 512pt; top: 25pt; height: 700pt;
}
@frame footer_frame { /* Another static Frame */
-pdf-frame-content: footer_content;
left: 50pt; width: 512pt; top: 772pt; height: 20pt;
}
}
</style>
</head>
<body>
"""
content_with_header = str(header_html) + str(template_courrier_data['contenu_doc']) + str("</body> </html>")
# print(" ### content_with_header = ", content_with_header)
contenu_doc_Template = jinja2.Template(str(content_with_header))
sourceHtml = contenu_doc_Template.render(params=body["params"])
todays_date = str(date.today().strftime("%d/%m/%Y"))
ts = datetime.now().timestamp()
ts = str(ts).replace(".", "").replace(",", "")[-3:]
orig_file_name = "Bulletin_Note_" + str(statgiaire_data['nom'] + '_' + statgiaire_data['prenom']) + "_" + str(
ts) + ".pdf"
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
# open output file for writing (truncated binary)
resultFile = open(outputFilename, "w+b")
# convert HTML to PDF #
pisaStatus = pisa.CreatePDF(
src=sourceHtml, # the HTML to convert
dest=resultFile) # file handle to receive result
# close output file
resultFile.close()
pied_page = ""
if ("company_data" in convention_dictionnary_data.keys()):
if ("societe_nom" in convention_dictionnary_data['company_data'].keys()):
pied_page = convention_dictionnary_data['company_data']['societe_nom'] + ", Num NDA " + \
convention_dictionnary_data['company_data']['societe_num_nda']
pied_page = pied_page + ", Siret : " + convention_dictionnary_data['company_data']['societe_siret']
pied_page = pied_page + ", Adresse " + convention_dictionnary_data['company_data'][
'societe_adr_street'] + " " + convention_dictionnary_data['company_data']['societe_adr_zip']
pied_page = pied_page + " " + convention_dictionnary_data['company_data']['societe_adr_city']
pied_page = pied_page + " Tel : " + convention_dictionnary_data['company_data']['societe_telephone']
pied_page = pied_page + " Email : " + convention_dictionnary_data['company_data']['societe_email']
input_file = outputFilename
output_file = outputFilename
# Récupérer les pages
reader = PdfReader(input_file)
pages = [pagexobj(p) for p in reader.pages]
# Composer le nouveau pdf
canvas = Canvas(output_file)
for page_num, page in enumerate(pages, start=1):
# Ajouter la page
canvas.setPageSize((page.BBox[2], page.BBox[3]))
# canvas.setPageSize((300, 300))
canvas.doForm(makerl(canvas, page))
# Dessiner le pied de page
pied_page_html = pied_page
pied_page_num_page_html = """%s/%s """ % (page_num, len(pages))
x = 500
canvas.saveState()
canvas.setStrokeColorRGB(0, 0, 0)
canvas.setLineWidth(0.5)
canvas.line(0, 50, 700, 50)
canvas.setFont('Times-Roman', 8)
canvas.drawString(50, 35, pied_page_html)
canvas.drawString(550, 20, pied_page_num_page_html)
canvas.restoreState()
canvas.showPage()
canvas.save()
return True, outputFilename
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 créer le fichier pdf Create_Bulletin_By_Inscrit_PDF "
"""
Creation d'une graphique et enregistrement de l'image
@ -4380,6 +4674,36 @@ def Calcul_Moyen_evaluation_participant_note_BC_UE(diction):
print(" ======================================================== ")
"""
Pour finir, on va applier que les regles de compensation
"""
local_diction = {}
local_diction['token'] = diction['token']
local_diction['session_id'] = diction['session_id']
if( "semestre" in diction.keys()):
local_diction['semestre'] = diction['semestre']
if ("diplome_id" in diction.keys()):
local_diction['diplome_id'] = diction['diplome_id']
val = ""
for tmp in tab_domaine_competence_ids :
val = str(tmp)+","+str(val)
print(" LIIIII val = ", val)
local_diction['tab_domaine_competence_ids'] = val
if ("class_id" in diction.keys()):
local_diction['class_id'] = diction['class_id']
print(" ## for compensation rules local_diction = : ",local_diction)
Run_BC_Compensation_Rules_01(local_diction)
return True, "Ok creation de la table des notes de travail"
except Exception as e:
@ -4468,6 +4792,10 @@ def Get_List_Evaluation_by_ue_bc_diplome_session_semestre_With_Filter(diction):
if (len(tab_inscrit_id) > 0):
filt_inscrit_id = {'inscrit_id': {'$in': tab_inscrit_id}}
filt_semestre = {}
if ("semestre" in diction.keys() and diction['semestre']):
filt_semestre = {'semestre': diction['semestre']}
"""
@ -4478,7 +4806,8 @@ def Get_List_Evaluation_by_ue_bc_diplome_session_semestre_With_Filter(diction):
data_cle['valide'] = "1"
data_cle['locked'] = "0"
query = {"$and": [filt_session_id, filt_ue_id, data_cle, filt_inscrit_id, filt_rattrapage, filt_tab_domaine_competence_id, filt_tab_diplome_id]}
query = {"$and": [filt_session_id, filt_ue_id, data_cle, filt_inscrit_id, filt_rattrapage, filt_tab_domaine_competence_id, filt_tab_diplome_id,
filt_semestre]}
print(" ### Get_List_Evaluation_by_ue_bc_diplome_session_semestre_With_Filter query = ", query)
@ -4565,6 +4894,235 @@ def Get_List_Evaluation_by_ue_bc_diplome_session_semestre_With_Filter(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 évaluations "
"""
Vue simplifiée de evaluation par BC/ETUDIANT
"""
def Get_List_Evaluation_Simple_wiew_by_ue_bc_diplome_session_semestre_With_Filter(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token','class_external_code', 'tab_ue_id', 'tab_session_id', 'tab_inscrit_id',
'jury_apprenant_agenda_id', 'tab_domaine_competence_id', 'tab_diplome_id', 'rattrapage',
'semestre']
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', ]
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
filt_session_id = {}
if( "tab_session_id" in diction.keys() ):
tab_session_id = str(diction['tab_session_id']).split(",")
if(len(tab_session_id) > 0 ):
filt_session_id = {'session_id':{'$in': tab_session_id }}
filt_ue_id = {}
if ("tab_ue_id" in diction.keys()):
tab_ue_id = str(diction['tab_ue_id']).split(",")
if (len(tab_ue_id) > 0):
filt_ue_id = {'ue_id': {'$in': tab_ue_id}}
filt_tab_diplome_id = {}
if ("tab_diplome_id" in diction.keys()):
tab_diplome_id = str(diction['tab_diplome_id']).split(",")
if (len(tab_diplome_id) > 0):
filt_tab_diplome_id = {'diplome_id': {'$in': tab_diplome_id}}
filt_tab_domaine_competence_id = {}
if ("tab_domaine_competence_id" in diction.keys()):
tab_domaine_competence_id = str(diction['tab_domaine_competence_id']).split(",")
if (len(tab_domaine_competence_id) > 0):
filt_tab_domaine_competence_id = {'domaine_competence_id': {'$in': tab_domaine_competence_id}}
filt_rattrapage = {'rattrapage': {"$ne":"1"} }
if ("rattrapage" in diction.keys() and diction['rattrapage'] == "1"):
filt_rattrapage = {'rattrapage': "1"}
filt_inscrit_id = {}
if ("tab_inscrit_id" in diction.keys()):
tab_inscrit_id = str(diction['tab_inscrit_id']).split(",")
if (len(tab_inscrit_id) > 0):
filt_inscrit_id = {'inscrit_id': {'$in': tab_inscrit_id}}
"""
Clés de mise à jour
"""
data_cle = {}
data_cle['partner_owner_recid'] = str(my_partner['recid'])
data_cle['valide'] = "1"
data_cle['locked'] = "0"
query = {"$and": [filt_session_id, filt_ue_id, data_cle, filt_inscrit_id, filt_rattrapage, filt_tab_domaine_competence_id, filt_tab_diplome_id,
]}
print(" ### Get_List_Evaluation_by_ue_bc_diplome_session_semestre_With_Filter query = ", query)
pipeline = [
{
"$match":
query
},
{
"$group": {
"_id": {
"inscrit_id": "$inscrit_id",
"inscrit_nom": "$inscrit_nom",
"inscrit_prenom": "$inscrit_prenom",
"inscrit_email": "$inscrit_email",
"domaine_competence_id": "$domaine_competence_id",
"domaine_competence_id_code": "$domaine_competence_id_code",
"diplome_id": "$diplome_id",
"diplome_id_code": "$diplome_id_code",
"absence_deplace_seuil": "$absence_deplace_seuil",
"domaine_competence_seuil_absence": "$domaine_competence_seuil_absence",
"domaine_competence_total_heure": "$domaine_competence_total_heure",
"is_domaine_competence_validated": "$is_domaine_competence_validated",
"pourcentage_absence_non_justifed": "$pourcentage_absence_non_justifed",
"total_heure_absence_non_justifie": "$total_heure_absence_non_justifie",
"jury_observation_dom_compet": "$jury_observation_dom_compet",
"jury_note_dom_compet": "$jury_note_dom_compet",
"jury_validation_dom_compet": "$jury_validation_dom_compet",
}
}
},
{
"$project": {
"_id": 0,
"inscrit_id": "$_id.inscrit_id",
"inscrit_nom": "$_id.inscrit_nom",
"inscrit_prenom": "$_id.inscrit_prenom",
"inscrit_email": "$_id.inscrit_email",
"domaine_competence_id": "$_id.domaine_competence_id",
"domaine_competence_id_code": "$_id.domaine_competence_id_code",
"diplome_id": "$_id.diplome_id",
"diplome_id_code": "$_id.diplome_id_code",
"absence_deplace_seuil": "$_id.absence_deplace_seuil",
"domaine_competence_seuil_absence": "$_id.domaine_competence_seuil_absence",
"domaine_competence_total_heure": "$_id.domaine_competence_total_heure",
"is_domaine_competence_validated": "$_id.is_domaine_competence_validated",
"pourcentage_absence_non_justifed": "$_id.pourcentage_absence_non_justifed",
"total_heure_absence_non_justifie": "$_id.total_heure_absence_non_justifie",
"jury_observation_dom_compet": "$_id.jury_observation_dom_compet",
"jury_note_dom_compet": "$_id.jury_note_dom_compet",
"jury_validation_dom_compet": "$_id.jury_validation_dom_compet",
}
},
{
"$sort": {
"inscrit_nom": 1,
"inscrit_prenom": 1,
"domaine_competence_id_code": 1
}
}
]
print(" ### Get_List_Evaluation_by_ue_bc_diplome_session_semestre_With_Filter pipeline = ", pipeline)
RetObject = []
val_tmp = 0
for retval in MYSY_GV.dbname['work_calcul_moyenne_by_ue_bc_diplome_session_semestre'].aggregate(pipeline):
user = retval
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
print(" retval = ",retval)
class_id_external_code = ""
if ("class_id" in retval.keys() and retval['class_id']):
class_id_data = MYSY_GV.dbname['myclass'].find_one({'_id': ObjectId(str(retval['class_id'])),
'partner_owner_recid': my_partner['recid'],
'valide': '1',
'locked': '0'},
{'external_code': 1})
if (class_id_data and "external_code" in class_id_data.keys()):
class_id_external_code = class_id_data['external_code']
user['class_id_external_code'] = class_id_external_code
inscription_id_nom = ""
inscription_id_prenom = ""
inscription_id_mail = ""
if ("inscrit_id" in retval.keys() and retval['inscrit_id']):
inscription_id_data = MYSY_GV.dbname['inscription'].find_one({'_id': ObjectId(str(retval['inscrit_id'])),
'partner_owner_recid': my_partner['recid'],
'valide': '1',},
{'email': 1, 'nom':1, 'prenom':1})
if (inscription_id_data and "email" in inscription_id_data.keys()):
inscription_id_mail = inscription_id_data['email']
if (inscription_id_data and "nom" in inscription_id_data.keys()):
inscription_id_nom = inscription_id_data['nom']
if (inscription_id_data and "prenom" in inscription_id_data.keys()):
inscription_id_prenom = inscription_id_data['prenom']
user['inscription_id_mail'] = inscription_id_mail
user['inscription_id_nom'] = inscription_id_nom
user['inscription_id_prenom'] = inscription_id_prenom
if( "is_domaine_competence_validated" not in user.keys() or user['is_domaine_competence_validated'] not in ['','0', '1']):
user['is_domaine_competence_validated'] = ""
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de récupérer la liste des notes calculées "
"""
Update work_calcul_moyenne_by_ue_bc_diplome_session_semestre
@ -4577,7 +5135,7 @@ def Update_work_calcul_moyenne_by_ue_bc_diplome_session_semestre(diction):
Verification des input acceptés
"""
field_list = ['token', 'tab_ids', 'jury_observation', 'jury_note', 'jury_validation',
'validation_note']
'validation_note', ]
incom_keys = diction.keys()
for val in incom_keys:
@ -4638,6 +5196,17 @@ def Update_work_calcul_moyenne_by_ue_bc_diplome_session_semestre(diction):
if ("validation_note" in diction.keys()):
update_data['validation_note'] = str(diction['validation_note'])
if ("jury_observation_dom_compet" in diction.keys()):
update_data['jury_observation_dom_compet'] = str(diction['jury_observation_dom_compet'])
if ("jury_note_dom_compet" in diction.keys()):
update_data['jury_note_dom_compet'] = str(diction['jury_note_dom_compet'])
if ("jury_validation_dom_compet" in diction.keys()):
update_data['jury_validation_dom_compet'] = str(diction['jury_validation_dom_compet'])
MYSY_GV.dbname['work_calcul_moyenne_by_ue_bc_diplome_session_semestre'].update_many({'_id': {'$in': tab_ids_ObjectId},
'valide': '1',
@ -4655,6 +5224,91 @@ def Update_work_calcul_moyenne_by_ue_bc_diplome_session_semestre(diction):
return False, " Impossible de faire la mise à jour"
"""
Update work_calcul_moyenne_by_ue_bc_diplome_session_semestre POUR observation sur bloc de compétence
"""
def Update_BC_Observation_work_calcul_moyenne_by_ue_bc(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'inscrit_id', 'domaine_competence_id', 'diplome_id', 'jury_observation_dom_compet', 'jury_note_dom_compet', 'jury_validation_dom_compet',
]
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', 'inscrit_id', 'domaine_competence_id', 'diplome_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
update_data = {}
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
if ("jury_observation_dom_compet" in diction.keys()):
update_data['jury_observation_dom_compet'] = str(diction['jury_observation_dom_compet'])
if ("jury_note_dom_compet" in diction.keys()):
update_data['jury_note_dom_compet'] = str(diction['jury_note_dom_compet'])
if ("jury_validation_dom_compet" in diction.keys()):
update_data['jury_validation_dom_compet'] = str(diction['jury_validation_dom_compet'])
data_key = {}
data_key['diplome_id'] = diction['diplome_id']
data_key['inscrit_id'] = diction['inscrit_id']
data_key['domaine_competence_id'] = diction['domaine_competence_id']
data_key['partner_owner_recid'] = str(my_partner['recid'])
MYSY_GV.dbname['work_calcul_moyenne_by_ue_bc_diplome_session_semestre'].update_many(data_key,
{'$set': update_data}
)
return True, " La mise à jour a été 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 faire la mise à jour"
"""
Recuperation les notes detaillées suite au calcul par UE (UE)
"""
@ -4862,7 +5516,7 @@ def Run_BC_Compensation_Rules_01(diction):
Verification des input acceptés
"""
field_list = ['token', 'session_id', 'diplome_id', 'tab_domaine_competence_ids',
'class_id']
'class_id', 'semestre']
incom_keys = diction.keys()
for val in incom_keys:
@ -4957,12 +5611,14 @@ def Run_BC_Compensation_Rules_01(diction):
tab_domaine_competence_ids = default_tab_domaine_competence_ids
print(" ### Run_BC_Compensation_Rules_01 :tab_domaine_competence_ids = ", tab_domaine_competence_ids)
for domaine_competence_id in tab_domaine_competence_ids:
print(" TRAINTEMENT COMPENSATION DOMAINE DE COMPETENCE ", domaine_competence_id)
tab_inscrit_id = []
for inscrit in MYSY_GV.dbname['inscription'].find({'valide': '1', 'status': '1',
'partner_owner_recid': str(my_partner['recid']),
'partner_owner_recid': str(my_partner['recid']),
'session_id': str(is_session_valide_data['_id'])}):
tab_inscrit_id.append(str(inscrit['_id']))
@ -4975,6 +5631,7 @@ def Run_BC_Compensation_Rules_01(diction):
pour calculer les moyennes par UE
"""
for inscrit_id in tab_inscrit_id:
"""
Aller chercher la liste des note concernées par :
- ce type d'evaluation (ex : les td, tp, exam)
@ -4982,88 +5639,141 @@ def Run_BC_Compensation_Rules_01(diction):
- ce bloc de compétence
- pour chaque inscrit, calculer la moyenne : tab_inscrit_id.append(str(inscrit['_id']))
"""
if( str(inscrit_id) == "69d38f86b4469130284c79c2"):
print(" ## inscrit_id = ", inscrit_id)
inscrit_data = MYSY_GV.dbname['inscription'].find_one({'valide': '1', 'status': '1',
'partner_owner_recid': str(my_partner['recid']),
'_id': ObjectId(inscrit_id)},
{'_id': 1, 'nom': 1, 'email': 1, 'prenom': 1})
print(" ======================================================== ")
print(" ## INSCRIT = ", str(inscrit_data['nom']), str(inscrit_data['prenom']),str(inscrit_data['email']))
print(" ## inscrit_id = ", inscrit_id)
inscrit_data = MYSY_GV.dbname['inscription'].find_one({'valide': '1', 'status': '1',
'partner_owner_recid': str(my_partner['recid']),
'_id': ObjectId(inscrit_id)},
{'_id': 1, 'nom': 1, 'email': 1, 'prenom': 1})
"""
Recuprer les notes calculée (par Diplome / BC / UE de cet etudiant
"""
qry_get_data = {}
qry_get_data['inscrit_id'] = str(inscrit_id)
qry_get_data['domaine_competence_id'] = str(domaine_competence_id)
qry_get_data['diplome_id'] = str(diction['diplome_id'])
qry_get_data['partner_owner_recid'] = str(my_partner['recid'])
print(" ======================================================== ")
print(" ## INSCRIT = ", str(inscrit_data['nom']), str(inscrit_data['prenom']),str(inscrit_data['email']))
"""
Recuprer les notes calculée (par Diplome / BC / UE de cet etudiant
"""
qry_get_data = {}
qry_get_data['inscrit_id'] = str(inscrit_id)
qry_get_data['domaine_competence_id'] = str(domaine_competence_id)
qry_get_data['diplome_id'] = str(diction['diplome_id'])
qry_get_data['partner_owner_recid'] = str(my_partner['recid'])
"""
if( "semestre" in diction.keys() and diction['semestre']):
qry_get_data['semestre"'] = str(diction['semestre'])
"""
print(" qry_get_data = ", qry_get_data)
print(" qry_get_data = ", qry_get_data)
cpt = 0
non_conclusive_nb_item = 0
non_conclusive_somme_note = 0
non_conclusive_moyenne_note = 0
cpt = 0
non_conclusive_nb_item = 0
non_conclusive_somme_note = 0
non_conclusive_moyenne_note = 0
is_non_conclusive_not_validated_moyenne = 0
is_one_conclusive_not_validated = 0
is_non_conclusive_not_validated_moyenne = 0
is_one_conclusive_not_validated = 0
for calculeted_note in MYSY_GV.dbname['work_calcul_moyenne_by_ue_bc_diplome_session_semestre'].find(qry_get_data):
cpt = cpt +1
for calculeted_note in MYSY_GV.dbname['work_calcul_moyenne_by_ue_bc_diplome_session_semestre'].find(qry_get_data):
cpt = cpt +1
if( "conclusive" in calculeted_note.keys() and calculeted_note['conclusive'] != "1" and "moyenne_avant_coef" in calculeted_note.keys()):
print("calculeted_note : NON CONCLUSIVE Ligne= ", calculeted_note)
non_conclusive_nb_item = non_conclusive_nb_item + 1
non_conclusive_somme_note = non_conclusive_somme_note + mycommon.tryFloat(calculeted_note['moyenne_avant_coef'])
if( "conclusive" in calculeted_note.keys() and calculeted_note['conclusive'] != "1" and "moyenne_avant_coef" in calculeted_note.keys()):
print( " calculeted_note : NON CONCLUSIVE Ligne= ", calculeted_note)
non_conclusive_nb_item = non_conclusive_nb_item + 1
non_conclusive_somme_note = non_conclusive_somme_note + mycommon.tryFloat(calculeted_note['moyenne_avant_coef'])
if( "conclusive" in calculeted_note.keys() and calculeted_note['conclusive'] == "1" and "is_eu_validated" in calculeted_note.keys() ):
print("calculeted_note : CONCLUSIVE Ligne= ", calculeted_note)
if( calculeted_note['is_eu_validated'] != "1" ):
is_one_conclusive_not_validated = 1
print(" KOOOOOOO CONCLUSIVE Ligne NON VALIDEEE _id = ", str(calculeted_note['_id']), " NOTEE = ", str(calculeted_note['moyenne_avant_coef']), " SEUIL VAL = ", str(calculeted_note['ue_seuil_validation']) )
else:
print(" OKKKK TOP CONCLUSIVE Ligne VALIDEEE _id = ", str(calculeted_note['_id']), " NOTEE = ", str(calculeted_note['moyenne_avant_coef']), " SEUIL VAL = ", str(calculeted_note['ue_seuil_validation']) )
if( non_conclusive_nb_item > 0 ):
non_clusive_moyenne_note = round(non_conclusive_somme_note/non_conclusive_nb_item, 2)
print(" SOMME = ", str(non_conclusive_somme_note), " --- NB LIGNE = ", str(non_conclusive_nb_item), " -- non_clusive_moyenne_note = ", str(non_clusive_moyenne_note))
if( non_clusive_moyenne_note < 10 ):
is_non_conclusive_not_validated_moyenne = 1
print(" PAS VALIDEEE COMPENSATION DES NON CONCLUSIVES < 10 = ", str(non_clusive_moyenne_note))
if( "conclusive" in calculeted_note.keys() and calculeted_note['conclusive'] == "1" and "is_eu_validated" in calculeted_note.keys() ):
print(" calculeted_note : CONCLUSIVE Ligne= ", calculeted_note)
if( calculeted_note['is_eu_validated'] != "1" ):
is_one_conclusive_not_validated = 1
print(" KOOOOOOO CONCLUSIVE Ligne NON VALIDEEE _id = ", str(calculeted_note['_id']), " NOTEE = ", str(calculeted_note['moyenne_avant_coef']), " SEUIL VAL = ", str(calculeted_note['ue_seuil_validation']) )
else:
is_non_conclusive_not_validated_moyenne = 0
print(" OUI VALIDEEE COMPENSATION DES NON CONCLUSIVES > 10 = ", str(non_clusive_moyenne_note))
data_key = {}
data_key['inscrit_id'] = str(inscrit_id)
data_key['domaine_competence_id'] = str(domaine_competence_id)
data_key['diplome_id'] = str(diction['diplome_id'])
data_key['partner_owner_recid'] = str(my_partner['recid'])
print(" OKKKK TOP CONCLUSIVE Ligne VALIDEEE _id = ", str(calculeted_note['_id']), " NOTEE = ", str(calculeted_note['moyenne_avant_coef']), " SEUIL VAL = ", str(calculeted_note['ue_seuil_validation']) )
data_update = {}
if( is_non_conclusive_not_validated_moyenne == 0 and is_one_conclusive_not_validated == 0 and cpt > 0):
print(" ETUDIANT A VALIDER LE domaine_competence_id = ", str(domaine_competence_id))
data_update['is_domaine_competence_validated'] = "1"
if( non_conclusive_nb_item > 0 ):
non_clusive_moyenne_note = round(non_conclusive_somme_note/non_conclusive_nb_item, 2)
print(" SOMME = ", str(non_conclusive_somme_note), " --- NB LIGNE = ", str(non_conclusive_nb_item), " -- non_clusive_moyenne_note = ", str(non_clusive_moyenne_note))
if( non_clusive_moyenne_note < 10 ):
is_non_conclusive_not_validated_moyenne = 1
print(" PAS VALIDEEE COMPENSATION DES NON CONCLUSIVES < 10 = ", str(non_clusive_moyenne_note))
else:
print(" ETUDIANT KOOOOO VALIDATION LE domaine_competence_id = ", str(domaine_competence_id))
data_update['is_domaine_competence_validated'] = "0"
is_non_conclusive_not_validated_moyenne = 0
print(" OUI VALIDEEE COMPENSATION DES NON CONCLUSIVES > 10 = ", str(non_clusive_moyenne_note))
print("data_key == ", data_key)
data_key = {}
data_key['inscrit_id'] = str(inscrit_id)
data_key['domaine_competence_id'] = str(domaine_competence_id)
data_key['diplome_id'] = str(diction['diplome_id'])
data_key['partner_owner_recid'] = str(my_partner['recid'])
result = MYSY_GV.dbname['work_calcul_moyenne_by_ue_bc_diplome_session_semestre'].update_many(
data_key,
{"$set": data_update},
)
data_update = {}
if( is_non_conclusive_not_validated_moyenne == 0 and is_one_conclusive_not_validated == 0 and cpt > 0):
print(" ETUDIANT A VALIDER LE domaine_competence_id = ", str(domaine_competence_id))
data_update['is_domaine_competence_validated'] = "1"
else:
print(" ETUDIANT KOOOOO VALIDATION LE domaine_competence_id = ", str(domaine_competence_id))
data_update['is_domaine_competence_validated'] = "0"
print("data_key == ", data_key)
"""
Aller recuperer les pourcentage d'absence pour l'inscrit a ce bloc de compétence
"""
local_diction = {}
local_diction['token'] = diction['token']
local_diction['session_id'] = diction['session_id']
local_diction['tab_inscrit_ids'] = str(inscrit_id)
local_diction['tab_domaine_competence_ids'] = str(domaine_competence_id)
print(" Calcul pourcentage absence pour local_diction = ", local_diction)
pourcentage_absence_non_justifed = 0
total_heure_absence_non_justifie = 0
domaine_competence_total_heure = 0
domaine_competence_seuil_absence = 0
absence_deplace_seuil = "0"
local_status, local_retval = Inscription_mgt.Internal_Get_Inscrit_Absence_Pourcentage_By_BC_For_Given_Session(local_diction)
if(local_status is False ):
mycommon.myprint(" WARNING : Impossible de calculer le pourcentage d'absence pour local_diction = "+ str(local_diction))
else:
print(" ## local_retval[0] = ", local_retval[0])
if( "tab_absence" in local_retval[0].keys() and len(local_retval[0]['tab_absence']) > 0 ):
local_data = local_retval[0]['tab_absence'][0]
print(" ### local_data = ", local_data)
if( "pourcentage_absence_non_justifed" in local_data.keys()):
pourcentage_absence_non_justifed = local_data['pourcentage_absence_non_justifed']
if ("total_heure_absence_non_justifie" in local_data.keys()):
total_heure_absence_non_justifie = local_data['total_heure_absence_non_justifie']
if ("domaine_competence_total_heure" in local_data.keys()):
domaine_competence_total_heure = local_data['domaine_competence_total_heure']
if ("domaine_competence_seuil_absence" in local_data.keys()):
domaine_competence_seuil_absence = local_data['domaine_competence_seuil_absence']
if ("absence_deplace_seuil" in local_data.keys() and local_data['absence_deplace_seuil']):
absence_deplace_seuil = local_data['absence_deplace_seuil']
data_update['pourcentage_absence_non_justifed'] = pourcentage_absence_non_justifed
data_update['total_heure_absence_non_justifie'] = total_heure_absence_non_justifie
data_update['domaine_competence_total_heure'] = domaine_competence_total_heure
data_update['domaine_competence_seuil_absence'] = domaine_competence_seuil_absence
data_update['absence_deplace_seuil'] = absence_deplace_seuil
result = MYSY_GV.dbname['work_calcul_moyenne_by_ue_bc_diplome_session_semestre'].update_many(
data_key,
{"$set": data_update},
)
return True, "Ok, La compensation (R01) a bien été appliquées"

View File

@ -362,7 +362,6 @@ def Get_domaine_competence_pedagogique_no_filter(diction):
return False, " Impossible de récupérer la liste des domaines de compétence pédagogique "
"""
Recuperer les données d'un domaine compétence pedagogique donnée
"""

44
main.py
View File

@ -14481,14 +14481,17 @@ def Get_List_Evaluation_Inscriptio_Note_Classement_With_Filter():
"""
API pour imprimer le bulletin de note d'un inscrit
"""
@app.route('/myclass/api/Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF/<token>/<tab_inscrit_ids>', methods=['POST','GET'])
@app.route('/myclass/api/Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF/<token>/<tab_inscrit_ids>/<diplome_id>/<tab_semestre>', methods=['POST','GET'])
@crossdomain(origin='*')
def Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF(token, tab_inscrit_ids):
def Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF(token, tab_inscrit_ids, diplome_id, tab_semestre):
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
payload = {}
payload['token'] = str(token)
payload['tab_inscrit_ids'] = str(tab_inscrit_ids)
payload['diplome_id'] = str(diplome_id)
if( str(diplome_id) != '-'):
payload['tab_semestre'] = str(tab_semestre)
print(" ### Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF : payload = ",str(payload))
@ -18236,6 +18239,23 @@ def Get_List_Evaluation_by_ue_bc_diplome_session_semestre_With_Filter():
return jsonify(status=localStatus, message=message )
"""
API de recuperation de note calculé : Vue simplifiée de evaluation par BC/ETUDIANT
"""
@app.route('/myclass/api/Get_List_Evaluation_Simple_wiew_by_ue_bc_diplome_session_semestre_With_Filter', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_List_Evaluation_Simple_wiew_by_ue_bc_diplome_session_semestre_With_Filter():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary(request.form.to_dict())
print(" ### Get_List_Evaluation_Simple_wiew_by_ue_bc_diplome_session_semestre_With_Filter : payload = ",payload)
localStatus, message= base_class_calcul_note.Get_List_Evaluation_Simple_wiew_by_ue_bc_diplome_session_semestre_With_Filter(payload)
return jsonify(status=localStatus, message=message )
"""
API de mettre à jour la table de notes calculées Bloc Compétence / UE / Diplome avec des valeurs comme :
'jury_observation', 'jury_note', 'jury_validation', 'validation_note'
@ -18250,6 +18270,26 @@ def Update_work_calcul_moyenne_by_ue_bc_diplome_session_semestre():
return jsonify(status=localStatus, message=message )
"""
API de mettre à jour / Update work_calcul_moyenne_by_ue_bc_diplome_session_semestre POUR observation sur bloc de compétence :
'jury_observation_dom_compet', 'jury_note_dom_compet', 'jury_validation_dom_compet'
"""
@app.route('/myclass/api/Update_BC_Observation_work_calcul_moyenne_by_ue_bc', methods=['POST','GET'])
@crossdomain(origin='*')
def Update_BC_Observation_work_calcul_moyenne_by_ue_bc():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary(request.form.to_dict())
print(" ### Update_BC_Observation_work_calcul_moyenne_by_ue_bc : payload = ",payload)
localStatus, message= base_class_calcul_note.Update_BC_Observation_work_calcul_moyenne_by_ue_bc(payload)
return jsonify(status=localStatus, message=message )
"""
API pour recupérer la liste detaillé des notes après calcul des moyennes par UE
"""