sss
parent
935e52c06c
commit
6251ffa25e
|
@ -1,7 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="28/04/2024 - 22h" />
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="02/05/2024 - 22h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
|
@ -70,13 +77,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00232" summary="01/03/2024 - 23h30">
|
||||
<created>1709333684065</created>
|
||||
<option name="number" value="00232" />
|
||||
<option name="presentableId" value="LOCAL-00232" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1709333684075</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00233" summary="02/03/2024 - 23h20">
|
||||
<created>1709418064492</created>
|
||||
<option name="number" value="00233" />
|
||||
|
@ -413,7 +413,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1714332210979</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="281" />
|
||||
<task id="LOCAL-00281" summary="02/05/2024 - 22h">
|
||||
<created>1714678394239</created>
|
||||
<option name="number" value="00281" />
|
||||
<option name="presentableId" value="LOCAL-00281" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1714678394240</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="282" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -455,7 +462,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="2/04/24 - 20h30" />
|
||||
<MESSAGE value="03/04/24 - 21h30" />
|
||||
<MESSAGE value="04/04/24 - 19h30" />
|
||||
<MESSAGE value="04/04/24 - 21h30" />
|
||||
|
@ -480,6 +486,7 @@
|
|||
<MESSAGE value="25/04/2024 - 19h" />
|
||||
<MESSAGE value="27/04/2024 - 22h" />
|
||||
<MESSAGE value="28/04/2024 - 22h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="28/04/2024 - 22h" />
|
||||
<MESSAGE value="02/05/2024 - 22h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="02/05/2024 - 22h" />
|
||||
</component>
|
||||
</project>
|
3974
Log/log_file.log
3974
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -772,7 +772,7 @@ def Get_Apprenant_List_Partner_with_filter(diction):
|
|||
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é, Creation partenaire annulée")
|
||||
3]) + " - Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Toutes les informations fournies ne sont pas valables"
|
||||
|
||||
"""
|
||||
|
|
|
@ -5329,7 +5329,7 @@ def Add_Update_UE_To_Class(diction):
|
|||
|
||||
"""
|
||||
pres_dist_hyp prend les valeurs suivantes :
|
||||
- 0 : presntiel
|
||||
- 0 : presentiel
|
||||
- 1 : distanciel
|
||||
- 2 : hybride
|
||||
"""
|
||||
|
|
16
main.py
16
main.py
|
@ -8745,6 +8745,22 @@ def Get_List_Unite_Enseignement_Of_Given_Class():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API permet de recupérer les données d'une UE dans une formation données
|
||||
c'est a dire les detail : credit, is_noted, etc
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Givent_Unite_Enseignement_Data_Of_Given_Class/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Givent_Unite_Enseignement_Data_Of_Given_Class():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Givent_Unite_Enseignement_Data_Of_Given_Class payload = ",payload)
|
||||
status, retval = unite_enseignement_mgt.Get_Givent_Unite_Enseignement_Data_Of_Given_Class(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
context = SSL.Context(SSL.SSLv23_METHOD)
|
||||
|
|
|
@ -366,14 +366,14 @@ def Get_List_Unite_Enseignement_with_filter(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token' 'code', 'titre']
|
||||
field_list = ['token', 'code', 'titre']
|
||||
|
||||
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"
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Toutes les informations fournies ne sont pas valables"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
|
@ -405,7 +405,7 @@ def Get_List_Unite_Enseignement_with_filter(diction):
|
|||
|
||||
filt_titre = {}
|
||||
if ("titre" in diction.keys()):
|
||||
filt_titre = {'titre': {'$regex': str(diction['nom']), "$options": "i"}}
|
||||
filt_titre = {'titre': {'$regex': str(diction['titre']), "$options": "i"}}
|
||||
|
||||
query = [{'$match': {
|
||||
'$and': [filt_code, filt_titre, {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0'} ]}},
|
||||
|
@ -416,7 +416,7 @@ def Get_List_Unite_Enseignement_with_filter(diction):
|
|||
val_tmp = 0
|
||||
|
||||
|
||||
for New_retVal in MYSY_GV.dbname['unite_enseignement'].find(query).sort([("_id", pymongo.DESCENDING), ]):
|
||||
for New_retVal in MYSY_GV.dbname['unite_enseignement'].aggregate(query):
|
||||
user = New_retVal
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
@ -450,7 +450,9 @@ def Get_List_Unite_Enseignement_with_filter(diction):
|
|||
"""
|
||||
Suppression d'une UE
|
||||
Si elle n'est pas utilisée
|
||||
/!\ : le controle d'utilisation ou non de l'UE n'est pas fait encore
|
||||
|
||||
regles : on ne peut supprimer une UE que si elle n'est pas utilisée dans une formation
|
||||
|
||||
"""
|
||||
def Delete_Given_Unite_Enseignement(diction):
|
||||
try:
|
||||
|
@ -492,7 +494,7 @@ def Delete_Given_Unite_Enseignement(diction):
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
# Verifier l'existance de l'opportunité
|
||||
# Verifier l'existance de l'ue
|
||||
is_ue_valide = MYSY_GV.dbname['unite_enseignement'].count_documents({'_id':ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
|
@ -501,6 +503,20 @@ def Delete_Given_Unite_Enseignement(diction):
|
|||
str(inspect.stack()[0][3]) + " L'identifiant de l'UE est invalide ")
|
||||
return False, " L'identifiant de l'UE est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Verifier si cette formation n'est pas utilisée dans une formation
|
||||
"""
|
||||
is_ue_used_in_class_count = MYSY_GV.dbname['myclass'].count_documents({'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'list_unite_enseignement._id':str(diction['_id'])})
|
||||
|
||||
if( is_ue_used_in_class_count > 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Cette UE est actuellement utilisée dans "+str(is_ue_used_in_class_count)+" formation. Impossible de la supprimer ")
|
||||
return False, " Cette UE est actuellement utilisée dans "+str(is_ue_used_in_class_count)+" formation. Impossible de la supprimer "
|
||||
|
||||
|
||||
qry = {'_id':ObjectId(str(diction['_id'])), 'partner_owner_recid':str(my_partner['recid'])}
|
||||
|
||||
ret_del_competence = MYSY_GV.dbname['unite_enseignement'].delete_many(qry)
|
||||
|
@ -682,3 +698,104 @@ def Get_List_Unite_Enseignement_Of_Given_Class(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 unites d'enseignement de la formation "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de recupérer les données d'une UE dans une formation données
|
||||
c'est a dire les detail : credit, is_noted, etc
|
||||
"""
|
||||
def Get_Givent_Unite_Enseignement_Data_Of_Given_Class(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'class_id', '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'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'class_id', '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
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0',
|
||||
'_id':ObjectId(str(diction['class_id'])),
|
||||
'list_unite_enseignement._id':str(my_partner['ue_id'])}
|
||||
|
||||
|
||||
print(" ### qry 0147 = ", qry)
|
||||
|
||||
for New_retVal in MYSY_GV.dbname['myclass'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
|
||||
if( "list_unite_enseignement" in New_retVal.keys() ):
|
||||
for local_val in New_retVal['list_unite_enseignement'] :
|
||||
|
||||
if( "_id" in local_val.keys() and local_val['_id'] == str(my_partner['ue_id']) ):
|
||||
user = local_val
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
"""
|
||||
Recuperation des données associées à cette UE
|
||||
"""
|
||||
ue_data = MYSY_GV.dbname['unite_enseignement'].find_one({'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0',
|
||||
'_id':ObjectId(str(local_val['_id']))})
|
||||
|
||||
if( ue_data ):
|
||||
for val in ue_data.keys() :
|
||||
user[str(val)] = ue_data[str(val)]
|
||||
|
||||
if (str(ue_data['duration_unite']) == "heure"):
|
||||
user['duration_concat'] = str(ue_data['duration']) + " h"
|
||||
elif (str(ue_data['duration_unite']) == "jour"):
|
||||
user['duration_concat'] = str(ue_data['duration']) + " j"
|
||||
elif (str(ue_data['duration_unite']) == "semaine"):
|
||||
user['duration_concat'] = str(ue_data['duration']) + " s"
|
||||
elif (str(ue_data['duration_unite']) == "mois"):
|
||||
user['duration_concat'] = str(ue_data['duration']) + " m"
|
||||
elif (str(ue_data['duration_unite']) == "annee"):
|
||||
user['duration_concat'] = str(ue_data['duration']) + " a"
|
||||
else:
|
||||
user['duration_concat'] = str(ue_data['duration']) + " ?"
|
||||
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
||||
#print(" #### RetObject = ", RetObject)
|
||||
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 données de unites d'enseignement de la formation "
|
||||
|
||||
|
|
Loading…
Reference in New Issue