parent
82970538d9
commit
a08b82f98d
|
@ -4,13 +4,12 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="04/06/2025 - 21h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="05/06/2025 - 20h">
|
||||
<change afterPath="$PROJECT_DIR$/ent_student_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_specific_fields.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_specific_fields.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_user_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_user_account.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/equipe_team_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/equipe_team_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" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -452,7 +451,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="467" />
|
||||
<option name="localTasksCounter" value="468" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -494,7 +493,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="11/02/2025 - 21h" />
|
||||
<MESSAGE value="18/02/2025 - 21h" />
|
||||
<MESSAGE value="27/02/2025 - 21h" />
|
||||
<MESSAGE value="04/03/2025 - 21h" />
|
||||
|
@ -519,6 +517,7 @@
|
|||
<MESSAGE value="31/05/2025 - 20h" />
|
||||
<MESSAGE value="02/06/2025 - 20h" />
|
||||
<MESSAGE value="04/06/2025 - 21h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="04/06/2025 - 21h" />
|
||||
<MESSAGE value="05/06/2025 - 20h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="05/06/2025 - 20h" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,275 @@
|
|||
"""
|
||||
-- Gestion de l'espace ENT des apprenants
|
||||
Ce fichier permet de gerer les fonction de ENT ETUDIANT
|
||||
|
||||
"""
|
||||
import bson
|
||||
import pymongo
|
||||
from pymongo import MongoClient
|
||||
import json
|
||||
from bson import ObjectId
|
||||
import re
|
||||
from datetime import datetime
|
||||
import prj_common as mycommon
|
||||
import secrets
|
||||
import inspect
|
||||
import sys, os
|
||||
import csv
|
||||
import pandas as pd
|
||||
from pymongo import ReturnDocument
|
||||
import GlobalVariable as MYSY_GV
|
||||
from math import isnan
|
||||
import GlobalVariable as MYSY_GV
|
||||
import ela_index_bdd_classes as eibdd
|
||||
import email_mgt as email
|
||||
import jinja2
|
||||
from flask import send_file
|
||||
from xhtml2pdf import pisa
|
||||
from email.message import EmailMessage
|
||||
from email.mime.text import MIMEText
|
||||
from email import encoders
|
||||
import smtplib
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.base import MIMEBase
|
||||
from email import encoders
|
||||
|
||||
"""
|
||||
Cette fonctions retourne les class_id d'un apprenant return : tab_class_id : [] - Uniquement les class_id
|
||||
"""
|
||||
|
||||
def Get_Apprenant_Tab_Class_Id(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'apprenant_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'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'apprenant_id']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Verifier la validité de l'apprenant
|
||||
"""
|
||||
is_apprenant_valide_count = MYSY_GV.dbname['apprenant'].count_documents(
|
||||
{'_id': ObjectId(str(diction['apprenant_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_apprenant_valide_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'apprenant est invalide ")
|
||||
return False, " L'identifiant de l'apprenant est invalide ",
|
||||
|
||||
apprenant_data = MYSY_GV.dbname['apprenant'].find_one(
|
||||
{'_id': ObjectId(str(diction['apprenant_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
qry = {}
|
||||
qry['partner_owner_recid'] = apprenant_data['partner_owner_recid']
|
||||
qry['apprenant_id'] = diction['apprenant_id']
|
||||
qry['valide'] = "1"
|
||||
qry['locked'] = "0"
|
||||
|
||||
query = [{'$match': {'$and': [qry]}},
|
||||
{'$sort': {'_id': -1}},
|
||||
{'$lookup':
|
||||
{
|
||||
'from': 'myclass',
|
||||
'localField': 'class_internal_url',
|
||||
'foreignField': 'internal_url',
|
||||
'pipeline': [{'$match': {'$and': [{}, {}]}},
|
||||
{'$project': {'_id': 1, }}],
|
||||
'as': 'myclass_collection'
|
||||
}
|
||||
},
|
||||
{'$lookup':
|
||||
{
|
||||
'from': 'apprenant',
|
||||
"let": {'apprenant_id': "$apprenant_id", 'partner_owner_recid': '$partner_owner_recid'},
|
||||
'pipeline': [{'$match':
|
||||
{'$expr': {'$and': [
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$apprenant_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
]}}},
|
||||
], 'as': 'apprenant_collection'}}
|
||||
]
|
||||
|
||||
print("#### Get_Apprenant_Tab_Class_Id laa 01 : query = ", query)
|
||||
RetObject = []
|
||||
cpt = 0
|
||||
|
||||
for retVal in MYSY_GV.dbname['inscription'].aggregate(query):
|
||||
val = {}
|
||||
if ('myclass_collection' in retVal.keys() and len(retVal['myclass_collection']) > 0):
|
||||
for class_data in retVal['myclass_collection']:
|
||||
RetObject.append(str(class_data['_id']))
|
||||
|
||||
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 la liste des class_id de l'apprenant "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des formation d'un apprenant pour son espace ENT
|
||||
"""
|
||||
def Get_Ent_Student_List_Class(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'apprenant_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'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'apprenant_id' ]
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Verifier la validité de l'apprenant
|
||||
"""
|
||||
is_apprenant_valide_count = MYSY_GV.dbname['apprenant'].count_documents({'_id':ObjectId(str(diction['apprenant_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
|
||||
if( is_apprenant_valide_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'apprenant est invalide ")
|
||||
return False, " L'identifiant de l'apprenant est invalide ",
|
||||
|
||||
apprenant_data = MYSY_GV.dbname['apprenant'].find_one(
|
||||
{'_id': ObjectId(str(diction['apprenant_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
|
||||
qry = {}
|
||||
qry['partner_owner_recid'] = apprenant_data['partner_owner_recid']
|
||||
qry['apprenant_id'] = diction['apprenant_id']
|
||||
qry['valide'] = "1"
|
||||
qry['locked'] = "0"
|
||||
|
||||
query = [{'$match': {'$and': [qry ]}},
|
||||
{'$sort': {'_id': -1}},
|
||||
{'$lookup':
|
||||
{
|
||||
'from': 'myclass',
|
||||
'localField': 'class_internal_url',
|
||||
'foreignField': 'internal_url',
|
||||
'pipeline': [{'$match': {'$and': [{}, {}]}},
|
||||
{'$project': {'title': 1, 'domaine': 1,
|
||||
'duration': 1,
|
||||
'duration_unit': 1,
|
||||
'_id': 1,
|
||||
'recyclage_delai': 1,
|
||||
'recyclage_periodicite': 1,
|
||||
'recyclage_alert': 1}}],
|
||||
'as': 'myclass_collection'
|
||||
}
|
||||
},
|
||||
{'$lookup':
|
||||
{
|
||||
'from': 'apprenant',
|
||||
"let": {'apprenant_id': "$apprenant_id", 'partner_owner_recid': '$partner_owner_recid'},
|
||||
'pipeline': [{'$match':
|
||||
{'$expr': {'$and': [
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$apprenant_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
]}}},
|
||||
], 'as': 'apprenant_collection'}}
|
||||
]
|
||||
|
||||
print("#### Get_Ent_Student_Class laa 01 : query = ", query)
|
||||
RetObject = []
|
||||
cpt = 0
|
||||
|
||||
for retVal in MYSY_GV.dbname['inscription'].aggregate(query):
|
||||
val = {}
|
||||
if ('myclass_collection' in retVal.keys() and len(retVal['myclass_collection']) > 0):
|
||||
val['id'] = str(cpt)
|
||||
cpt = cpt + 1
|
||||
val['_id'] = retVal['_id']
|
||||
|
||||
|
||||
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 les formations de l'apprenant "
|
||||
|
|
@ -947,7 +947,6 @@ def Get_List_Equipe_Team(diction):
|
|||
|
||||
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))
|
||||
|
|
26
main.py
26
main.py
|
@ -100,6 +100,7 @@ import base_class_calcul_note as base_class_calcul_note
|
|||
import jury_mgt as jury_mgt
|
||||
import financial_caracteristique_mgt as financial_caracteristique_mgt
|
||||
import reference_pedagogique_mgt as reference_pedagogique_mgt
|
||||
import ent_student_common as ent_student_common
|
||||
|
||||
import base_document_automatic_setup as base_document_automatic_setup
|
||||
|
||||
|
@ -12930,6 +12931,31 @@ def Get_Ref_Pedagogique_no_filter():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API - Gestion ENT Apprenant : Recuperation des formations d'un apprenant
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Ent_Student_List_Class/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Ent_Student_List_Class():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Ent_Student_List_Class : payload = ",str(payload))
|
||||
status, retval = ent_student_common.Get_Ent_Student_List_Class( payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API - Gestion ENT Apprenant : Recuperation uniquement les liste de class_id de l'apprenant
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Apprenant_Tab_Class_Id/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Apprenant_Tab_Class_Id():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Apprenant_Tab_Class_Id : payload = ",str(payload))
|
||||
status, retval = ent_student_common.Get_Apprenant_Tab_Class_Id( payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -587,7 +587,7 @@ def get_connected_data_from_token(connected_token = ""):
|
|||
"""
|
||||
tmp_val = None
|
||||
|
||||
if( token_data and "type" in token_data.keys() and str(token_data['type']) == "user"):
|
||||
if( token_data and "type" in token_data.keys() and ( str(token_data['type']) == "user" or str(token_data['type']) == "student" ) ):
|
||||
coll_token = MYSY_GV.dbname['user_account']
|
||||
tmp_val = coll_token.find_one({'token': str(connected_token), 'active': '1', 'locked': '0'})
|
||||
|
||||
|
@ -595,7 +595,6 @@ def get_connected_data_from_token(connected_token = ""):
|
|||
coll_token = MYSY_GV.dbname['partnair_account']
|
||||
tmp_val = coll_token.find_one({'token': str(connected_token), 'active': '1', 'locked': '0'})
|
||||
|
||||
|
||||
return True, tmp_val
|
||||
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in New Issue