17/05/2024 - 21h30
parent
a0c26d856e
commit
a44f0dcfda
|
@ -2,14 +2,10 @@
|
|||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="ddd">
|
||||
<change afterPath="$PROJECT_DIR$/notes_apprenant.py" afterDir="false" />
|
||||
<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$/Job_Cron.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron.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.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/categorie_formation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/categorie_formation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/notes_apprenant.py" beforeDir="false" afterPath="$PROJECT_DIR$/notes_apprenant_mgt.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
3141
Log/log_file.log
3141
Log/log_file.log
File diff suppressed because it is too large
Load Diff
136
main.py
136
main.py
|
@ -87,6 +87,8 @@ import categorie_formation_mgt as categorie_formation_mgt
|
|||
import domaine_formation_mgt as domaine_formation_mgt
|
||||
import invoice_paiement_mgt as invoice_paiement_mgt
|
||||
import Job_Cron as Job_Cron
|
||||
import notes_apprenant_mgt as notes_apprenant_mgt
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
cors = CORS(app, resources={r"/foo": {"origins": "*"}})
|
||||
|
@ -9190,6 +9192,140 @@ def Internal_Global_MySy_Cron_Traitement():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter un type d'evaluation
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Evaluation_Type/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Evaluation_Type():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Evaluation_Type payload = ",payload)
|
||||
status, retval = notes_apprenant_mgt.Add_Evaluation_Type(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
"""
|
||||
API pour mettre à jour un type d'evaluation
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Evaluation_Type/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Evaluation_Type():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Evaluation_Type payload = ",payload)
|
||||
status, retval = notes_apprenant_mgt.Update_Evaluation_Type(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour supprimer un type d'evaluation
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Type_Evaluation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Type_Evaluation():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Type_Evaluation payload = ",payload)
|
||||
status, retval = notes_apprenant_mgt.Delete_Type_Evaluation(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer la liste des types d'évaluation d'un partenaire
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Type_Evaluation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Type_Evaluation():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Type_Evaluation payload = ",payload)
|
||||
status, retval = notes_apprenant_mgt.Get_List_Type_Evaluation(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer un type d'evaluation donné
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Given_Type_Evaluation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Given_Type_Evaluation():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_Type_Evaluation payload = ",payload)
|
||||
status, retval = notes_apprenant_mgt.Get_Given_Type_Evaluation(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter une evaluation à une EU
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Class_UE_Evaluation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Class_UE_Evaluation():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Class_UE_Evaluation payload = ",payload)
|
||||
status, retval = notes_apprenant_mgt.Add_Class_UE_Evaluation(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre à jour l'evaluation d'une UE
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Class_UE_Evaluation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Class_UE_Evaluation():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Class_UE_Evaluation payload = ",payload)
|
||||
status, retval = notes_apprenant_mgt.Update_Class_UE_Evaluation(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API de récuperation de la liste des evaluations d'une formation
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Class_Evaluation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Class_Evaluation():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Class_Evaluation payload = ",payload)
|
||||
status, retval = notes_apprenant_mgt.Get_List_Class_Evaluation(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API de récuperation de la liste des evaluations d'une UE
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_UE_Evaluation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_UE_Evaluation():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_UE_Evaluation payload = ",payload)
|
||||
status, retval = notes_apprenant_mgt.Get_List_UE_Evaluation(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API de suppression d'un évalution donnée d'une UE
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Class_UE_Evaluation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Class_UE_Evaluation():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Class_UE_Evaluation payload = ",payload)
|
||||
status, retval = notes_apprenant_mgt.Delete_Class_UE_Evaluation(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
context = SSL.Context(SSL.SSLv23_METHOD)
|
||||
|
|
|
@ -550,6 +550,9 @@ def Add_Class_UE_Evaluation(diction):
|
|||
return False, " Impossible de créer l'évaluation pour l'UE "
|
||||
|
||||
|
||||
"""
|
||||
Mise à jour d'une evaluation d'une formation
|
||||
"""
|
||||
def Update_Class_UE_Evaluation(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
@ -606,15 +609,11 @@ def Update_Class_UE_Evaluation(diction):
|
|||
return False, " L'identifiant de l'évaluation est invalide "
|
||||
|
||||
|
||||
|
||||
local_class_ue_evaluation_id = diction['class_ue_evaluation_id']
|
||||
new_data = diction
|
||||
del diction['token']
|
||||
del diction['class_ue_evaluation_id']
|
||||
|
||||
# Initialisation des champs non envoyés à vide
|
||||
for val in field_list:
|
||||
if val not in diction.keys():
|
||||
new_data[str(val)] = ""
|
||||
|
||||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
|
@ -624,7 +623,7 @@ def Update_Class_UE_Evaluation(diction):
|
|||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
result = MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].find_one_and_update(
|
||||
{'_id': ObjectId(str(diction['class_ue_evaluation_id'])),
|
||||
{'_id': ObjectId(str(local_class_ue_evaluation_id)),
|
||||
'partner_owner_recid': my_partner['recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'
|
||||
|
@ -648,3 +647,225 @@ def Update_Class_UE_Evaluation(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de mettre à jour l'évaluation "
|
||||
|
||||
|
||||
"""
|
||||
Recuperation de la liste des evaluations d'une formation
|
||||
"""
|
||||
def Get_List_Class_Evaluation(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'class_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', 'class_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 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
|
||||
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['class_id'] = str(diction['class_id'])
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
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 évaluation de la formation "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperation de la liste des evaluations d'une UE
|
||||
"""
|
||||
def Get_List_UE_Evaluation(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'class_ue_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', 'class_ue_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 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
|
||||
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['class_ue_id'] = str(diction['class_ue_id'])
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
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 évaluation de l'UE "
|
||||
|
||||
|
||||
"""
|
||||
Suppresion d'une evaluation d'une formation.
|
||||
|
||||
/!\ : les regles ne sont pas encore implément. il faut le faire
|
||||
"""
|
||||
def Delete_Class_UE_Evaluation(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'class_ue_evaluation_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'class_ue_evaluation_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 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
|
||||
|
||||
|
||||
"""
|
||||
Verifier que class_ue_id est valide
|
||||
"""
|
||||
is_ue_id_existe_class = MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].count_documents({ '_id':ObjectId(str(diction['class_ue_evaluation_id'])),
|
||||
'partner_owner_recid':my_partner['recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'
|
||||
})
|
||||
|
||||
if (is_ue_id_existe_class != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'évaluation est invalide ")
|
||||
return False, " L'identifiant de l'évaluation est invalide "
|
||||
|
||||
delete = MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].delete_one({ '_id':ObjectId(str(diction['class_ue_evaluation_id'])),
|
||||
'partner_owner_recid':my_partner['recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'
|
||||
} )
|
||||
|
||||
print(" ")
|
||||
|
||||
return True, " La évaluation a été correctement supprimée"
|
||||
|
||||
|
||||
|
||||
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 supprimer l'évaluation "
|
Loading…
Reference in New Issue