23/11/2023 - 21h30

master
cherif 2023-11-23 21:43:20 +01:00
parent fc4e13ff8d
commit e04568b072
7 changed files with 2198 additions and 73 deletions

View File

@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="22/11/2023 - 23h00"> <list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="23/11/23 - 13:30">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Emargement/test_emargement.pdf" beforeDir="false" afterPath="$PROJECT_DIR$/Emargement/test_emargement.pdf" 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$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/base_config_modele_journee.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_config_modele_journee.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/emargement.py" beforeDir="false" afterPath="$PROJECT_DIR$/emargement.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.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> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -76,13 +78,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1680804787304</updated> <updated>1680804787304</updated>
</task> </task>
<task id="LOCAL-00107" summary="15/09/2023 - 18h">
<created>1694793521821</created>
<option name="number" value="00107" />
<option name="presentableId" value="LOCAL-00107" />
<option name="project" value="LOCAL" />
<updated>1694793521822</updated>
</task>
<task id="LOCAL-00108" summary="22/09/2023 - 12h53"> <task id="LOCAL-00108" summary="22/09/2023 - 12h53">
<created>1695380023775</created> <created>1695380023775</created>
<option name="number" value="00108" /> <option name="number" value="00108" />
@ -419,7 +414,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1700691598344</updated> <updated>1700691598344</updated>
</task> </task>
<option name="localTasksCounter" value="156" /> <task id="LOCAL-00156" summary="23/11/23 - 13:30">
<created>1700742130513</created>
<option name="number" value="00156" />
<option name="presentableId" value="LOCAL-00156" />
<option name="project" value="LOCAL" />
<updated>1700742130514</updated>
</task>
<option name="localTasksCounter" value="157" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -434,7 +436,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="17/10/2023 - 22h40" />
<MESSAGE value="17/10/2023 - 22h45" /> <MESSAGE value="17/10/2023 - 22h45" />
<MESSAGE value="zzz" /> <MESSAGE value="zzz" />
<MESSAGE value="22/10/2023 - 12h" /> <MESSAGE value="22/10/2023 - 12h" />
@ -459,6 +460,7 @@
<MESSAGE value="18/11/2023 - 17h00" /> <MESSAGE value="18/11/2023 - 17h00" />
<MESSAGE value="20/11/2023 - 21h00" /> <MESSAGE value="20/11/2023 - 21h00" />
<MESSAGE value="22/11/2023 - 23h00" /> <MESSAGE value="22/11/2023 - 23h00" />
<option name="LAST_COMMIT_MESSAGE" value="22/11/2023 - 23h00" /> <MESSAGE value="23/11/23 - 13:30" />
<option name="LAST_COMMIT_MESSAGE" value="23/11/23 - 13:30" />
</component> </component>
</project> </project>

View File

@ -37,7 +37,7 @@ endobj
endobj endobj
7 0 obj 7 0 obj
<< <<
/Author () /CreationDate (D:20230822120813-01'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20230822120813-01'00') /Producer (xhtml2pdf <https://github.com/xhtml2pdf/xhtml2pdf/>) /Author () /CreationDate (D:20231123213045-01'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20231123213045-01'00') /Producer (xhtml2pdf <https://github.com/xhtml2pdf/xhtml2pdf/>)
/Subject () /Title () /Trapped /False /Subject () /Title () /Trapped /False
>> >>
endobj endobj
@ -48,10 +48,10 @@ endobj
endobj endobj
9 0 obj 9 0 obj
<< <<
/Filter [ /ASCII85Decode /FlateDecode ] /Length 3651 /Filter [ /ASCII85Decode /FlateDecode ] /Length 1859
>> >>
stream stream
Gb!;h?'F'P&U_?#_7/'r3f!dNrMJ4F,*ct;niiqnV2EQuF(J.h=YB[OOPD,d`:0N,@Kh@ZZd+KsSfVWn%XZ6McLUtD*rl,@F-cdlPWa;p1MsGHDj`4XR@RYqcV?G!]m8(VkUYAoW[R2=cC1n8Fkmfrf3-\XXhHunnuAeG2Z%mN.r/?_CSa+0WpFiQN6,'sR(@eBoKLa3C7At:qW,1)E!,=59UR62H6$R3e!*l4GM@UFAWIq=DdM9"n`_ZQs-L@h]>kG+kIZLFhe&eDH[\9Ym.AorG$_0:lHRu3S!Di6UIn7oII9=+hW,pJmGDh'`_Xl_<OAc@:"0-g^U%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L%*rPc!Hn5_ao~>endstream
endobj endobj
xref xref
0 10 0 10
@ -68,7 +68,7 @@ xref
trailer trailer
<< <<
/ID /ID
[<44c9cae7153c77931f6c043a6c6a4568><44c9cae7153c77931f6c043a6c6a4568>] [<435940486b7b055693a3310f4a22df67><435940486b7b055693a3310f4a22df67>]
% ReportLab generated PDF document -- digest (http://www.reportlab.com) % ReportLab generated PDF document -- digest (http://www.reportlab.com)
/Info 7 0 R /Info 7 0 R
@ -76,5 +76,5 @@ trailer
/Size 10 /Size 10
>> >>
startxref startxref
4772 2980
%%EOF %%EOF

File diff suppressed because one or more lines are too long

View File

@ -1817,10 +1817,8 @@ def SendEmargementMail( diction):
# Recuperation des infos de l'emargement # Recuperation des infos de l'emargement
print("my_emarge_id = " + str(my_emarge_id)) print("my_emarge_id = " + str(my_emarge_id))
val_emarge = MYSY_GV.dbname['emargement'].find_one({'_id':ObjectId(my_emarge_id)}) val_emarge = MYSY_GV.dbname['emargement'].find_one({'_id':ObjectId(my_emarge_id), 'partner_owner_recid':str(partner_recid)})
print("val_emarge = "+str(val_emarge))
print("ID = " + str(val_emarge['_id']))
print("email = " + str(val_emarge['email']))
# recuperation du titre de la formation # recuperation du titre de la formation
local_class_title = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(val_emarge['class_internal_url']), local_class_title = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(val_emarge['class_internal_url']),
@ -1852,7 +1850,7 @@ def SendEmargementMail( diction):
# JINJA2 # JINJA2
templateLoader = jinja2.FileSystemLoader(searchpath="./") templateLoader = jinja2.FileSystemLoader(searchpath="./")
templateEnv = jinja2.Environment(loader=templateLoader) templateEnv = jinja2.Environment(loader=templateLoader)
TEMPLATE_FILE = "Template/ MySy_Emargement.html" TEMPLATE_FILE = "Template/MySy_Emargement.html"
template = templateEnv.get_template(TEMPLATE_FILE) template = templateEnv.get_template(TEMPLATE_FILE)
# This data can come from database query # This data can come from database query
# envoie de l'emargement du matin # envoie de l'emargement du matin
@ -1872,7 +1870,7 @@ def SendEmargementMail( diction):
"email": str(val_emarge['email']), "email": str(val_emarge['email']),
"class_title": str(local_class_title['title']), "class_title": str(local_class_title['title']),
"date": str(val_emarge['date']), "date": str(val_emarge['date']),
"session": "Matinée", "session": str(val_emarge['sequence_start'])+" - "+str(val_emarge['sequence_end']),
"code_session":str(local_session_data['code_session']), "code_session":str(local_session_data['code_session']),
"mysyurl": str(myurl), "mysyurl": str(myurl),
@ -1884,7 +1882,7 @@ def SendEmargementMail( diction):
msg.set_content(sourceHtml, subtype='html') msg.set_content(sourceHtml, subtype='html')
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
msg['Bcc'] = 'contact@mysy-training.com' msg['Bcc'] = 'contact@mysy-training.com'
msg['Subject'] = "[MySy Training Technology] : Emargement Matinée du "+str(val_emarge['date']) msg['Subject'] = "[MySy Training Technology] : Emargement "+str(val_emarge['sequence_start'])+" - "+str(val_emarge['sequence_end'])
msg['To'] = str(val_emarge['email']) msg['To'] = str(val_emarge['email'])
smtpserver.ehlo() smtpserver.ehlo()
@ -1894,6 +1892,7 @@ def SendEmargementMail( diction):
#smtpserver.close() #smtpserver.close()
print(" Email matinée envoyé " + str(my_emarge_id)) print(" Email matinée envoyé " + str(my_emarge_id))
"""
# envoie de l'emargement de l'apres midi # envoie de l'emargement de l'apres midi
myurl = "http://127.0.0.1:5001/myclass/api/UserEmargementValidation/" + str(val_emarge['_id']) + "/2" myurl = "http://127.0.0.1:5001/myclass/api/UserEmargementValidation/" + str(val_emarge['_id']) + "/2"
@ -1935,6 +1934,7 @@ def SendEmargementMail( diction):
smtpserver.close() smtpserver.close()
print(" Email Apres midi envoyé " + str(my_emarge_id)) print(" Email Apres midi envoyé " + str(my_emarge_id))
"""
return True, "Email envoyé " return True, "Email envoyé "

View File

@ -209,6 +209,177 @@ def CreateTableauEmargement(diction):
return False, "Impossible de créer le tableau d'emargement" return False, "Impossible de créer le tableau d'emargement"
"""
23/11/2023 : Evolution en prenant les sequences.
Evolution de la fonction de création du tableau d'emargement.
Dans cette evolution, on plutot recuperer les sequence déjà créesq
"""
def CreateTableauEmargement_From_Sequence(diction):
try:
'''
# Verification que les champs reçus dans l'API sont bien dans la liste des champs autorisés
# Cela evite le cas ou une entité tierce ajouter les valeurs inconnu dans l'API
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
# field_list.
'''
field_list = ['class_internal_url', 'session_id', 'token']
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é, Creation partenaire annulée")
return False, "Impossible de créer la liste d'emargement. Toutes les informations fournies ne sont pas valables"
"""
Verification de la liste des champs obligatoires
"""
field_list_obligatoire = ['class_internal_url', 'session_id', '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 liste ")
return False, "Impossible de créer la liste d'emargement, Toutes les informations necessaires n'ont pas été fournies"
mydata = {}
my_token = ""
if ("token" in diction.keys()):
if diction['token']:
my_token = diction['token']
# Verifier la validité du token
retval = mycommon.check_partner_token_validity("", my_token)
if retval is False:
return "Err_Connexion", " La session de connexion n'est pas valide"
class_internal_url = ""
if ("class_internal_url" in diction.keys()):
if diction['class_internal_url']:
class_internal_url = diction['class_internal_url']
partner_recid = mycommon.get_parnter_recid_from_token(my_token)
if (partner_recid is False):
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de créer la liste d'emargement ")
return False, "Impossible de créer la liste d'emargement "
session_id = ""
if ("session_id" in diction.keys()):
if diction['session_id']:
mydata['session_id'] = diction['session_id']
session_id = diction['session_id']
"""
Recuperation des info de la session de formation
"""
date_du = ""
date_au = ""
ville = ""
code_postal = ""
adresse = ""
qry = {"_id":ObjectId(str(session_id)), "valide": "1", 'partner_owner_recid':str(partner_recid)}
session_formation_count = MYSY_GV.dbname['session_formation'].count_documents(qry)
if( session_formation_count <= 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " - Aucune session de formation valide ")
return False, "Aucune session de formation valide "
session_data = MYSY_GV.dbname['session_formation'].find_one({"_id":ObjectId(str(session_id)), "valide": "1"})
# Recuperation de la liste des sequences associées à la session
i = 0 # compteur de securité
# On vide la collection emargement pour la session = str(session_id)
local_myquery = {"session_id": str(session_id), 'partner_owner_recid':str(partner_recid)}
x = MYSY_GV.dbname['emargement'].delete_many(local_myquery)
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - INFO : "+str(x.deleted_count)+" Documents supprimés de la collection : emargement : session = "+str(session_id) )
# Verification qu'il y a bien des séquences de formation pour cette session
session_sequence_count = MYSY_GV.dbname['session_formation_sequence'].count_documents({'session_id': str(session_id),
'locked': '0',
'valide': '1',
'partner_owner_recid': str(
partner_recid)})
if( session_sequence_count <= 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " - Cette session de formation n'a aucune séquence valide ")
return False, " Cette session de formation n'a aucune séquence valide "
#print("#### Liste Date = "+str(liste_date))
coll_emargement = MYSY_GV.dbname['emargement']
#Recuperation de la liste des participants dont l'inscription est validée
for tmp_val in MYSY_GV.dbname['inscription'].find({'session_id':str(session_id),
'class_internal_url':str(class_internal_url),
'status':'1',
'partner_owner_recid':str(partner_recid)} ):
my_local_data = {}
my_local_data['email'] = tmp_val['email']
my_local_data['nom'] = tmp_val['nom']
my_local_data['prenom'] = tmp_val['prenom']
my_local_data['session_id'] = tmp_val['session_id']
my_local_data['class_internal_url'] = tmp_val['class_internal_url']
my_local_data['date_update'] = str(datetime.now())
# Recuperation de liste des sequences
for session_sequence in MYSY_GV.dbname['session_formation_sequence'].find({'session_id':str(session_id),
'locked':'0',
'valide':'1',
'partner_owner_recid':str(partner_recid)} ):
query_key = {}
query_key['email'] = tmp_val['email']
query_key['session_id'] = tmp_val['session_id']
query_key['class_internal_url'] = tmp_val['class_internal_url']
query_key['date'] = str(session_sequence['sequence_start'])[0:10]
query_key['sequence_start'] = str(session_sequence['sequence_start'])
query_key['sequence_end'] = str(session_sequence['sequence_end'])
new_my_local_data = {}
new_my_local_data['email'] = tmp_val['email']
new_my_local_data['nom'] = tmp_val['nom']
new_my_local_data['prenom'] = tmp_val['prenom']
new_my_local_data['session_id'] = tmp_val['session_id']
new_my_local_data['class_internal_url'] = tmp_val['class_internal_url']
new_my_local_data['date_update'] = str(datetime.now())
query_key['date'] = str(session_sequence['sequence_start'])[0:10]
new_my_local_data['is_present'] = False
new_my_local_data['matin'] = False
new_my_local_data['apresmidi'] = False
new_my_local_data['partner_owner_recid'] = str(str(partner_recid))
#print("### emargement insertion de : "+str(new_my_local_data))
local_ret_val = coll_emargement.find_one_and_update(
query_key,
{"$set": new_my_local_data},
upsert=True,
return_document=ReturnDocument.AFTER
)
return True, "ok"
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible de créer le tableau d'emargement"
""" """
Cette fonction récupérer la liste d'emargement Cette fonction récupérer la liste d'emargement
""" """
@ -271,7 +442,7 @@ def GetTableauEmargement(diction):
val_tmp = 1 val_tmp = 1
RetObject = [] RetObject = []
for retval in MYSY_GV.dbname['emargement'].find({'session_id':str(session_id), for retval in MYSY_GV.dbname['emargement'].find({'session_id':str(session_id),
'class_internal_url':str(class_internal_url)}).sort([("date",pymongo.ASCENDING),]): 'class_internal_url':str(class_internal_url)}).sort([("date",pymongo.ASCENDING), ("sequence_start",pymongo.ASCENDING), ("sequence_end",pymongo.ASCENDING),]):
user = retval user = retval
user['id'] = str(val_tmp) user['id'] = str(val_tmp)
RetObject.append(mycommon.JSONEncoder().encode(user)) RetObject.append(mycommon.JSONEncoder().encode(user))
@ -294,7 +465,7 @@ def UpdateUserEmargementDate(diction):
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste # Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
# field_list. # field_list.
''' '''
field_list = [ 'session_id', 'token', 'email', 'date', 'matin', 'apresmidi', 'class_internal_url'] field_list = [ 'session_id', 'token', 'email', 'date', 'matin', 'apresmidi', 'class_internal_url', 'is_present', '_id']
incom_keys = diction.keys() incom_keys = diction.keys()
for val in incom_keys: for val in incom_keys:
if val not in field_list and val.startswith('my_') is False: if val not in field_list and val.startswith('my_') is False:
@ -305,7 +476,7 @@ def UpdateUserEmargementDate(diction):
""" """
Verification de la liste des champs obligatoires Verification de la liste des champs obligatoires
""" """
field_list_obligatoire = [ 'session_id', 'token', 'email', 'date'] field_list_obligatoire = [ 'session_id', 'token', 'email', 'date', '_id']
for val in field_list_obligatoire: for val in field_list_obligatoire:
if val not in diction: if val not in diction:
@ -313,8 +484,6 @@ def UpdateUserEmargementDate(diction):
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans liste ") str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans liste ")
return False, "Impossible de créer la liste d'emargement, Toutes les informations necessaires n'ont pas été fournies" return False, "Impossible de créer la liste d'emargement, Toutes les informations necessaires n'ont pas été fournies"
mydata = {}
my_token = "" my_token = ""
if ("token" in diction.keys()): if ("token" in diction.keys()):
if diction['token']: if diction['token']:
@ -327,48 +496,30 @@ def UpdateUserEmargementDate(diction):
my_email = "" is_present = ""
if ("email" in diction.keys()): if ("is_present" in diction.keys()):
if diction['email']: if diction['is_present']:
my_email = diction['email'] is_present = diction['is_present']
mydata['email'] = diction['email']
my_date = ""
if ("date" in diction.keys()):
if diction['date']:
my_date = diction['date']
mydata['date'] = diction['date']
my_matin = ""
if ("matin" in diction.keys()):
if diction['matin']:
my_matin = diction['matin']
my_apresmidi = ""
if ("apresmidi" in diction.keys()):
if diction['apresmidi']:
my_apresmidi = diction['apresmidi']
class_internal_url = ""
if ("class_internal_url" in diction.keys()):
if diction['class_internal_url']:
class_internal_url = diction['class_internal_url']
mydata['class_internal_url'] = class_internal_url
partner_recid = mycommon.get_parnter_recid_from_token(my_token) partner_recid = mycommon.get_parnter_recid_from_token(my_token)
if (partner_recid is False): if (partner_recid is False):
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de valider l'emargement ") mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de valider l'emargement ")
return False, "Impossible de valider l'emargement " return False, "Impossible de valider l'emargement "
session_id = "" mydata = {}
if ("session_id" in diction.keys()):
if diction['session_id']:
mydata['session_id'] = diction['session_id']
session_id = diction['session_id']
mydata['date_update'] = str(datetime.now()) mydata['date_update'] = str(datetime.now())
if( my_matin == "1"): if (is_present == "1"):
mydata['is_present'] = True
elif (is_present == "0"):
mydata['is_present'] = False
"""if( my_matin == "1"):
mydata['matin'] = True mydata['matin'] = True
elif (my_matin == "0"): elif (my_matin == "0"):
mydata['matin'] = False mydata['matin'] = False
@ -377,13 +528,16 @@ def UpdateUserEmargementDate(diction):
mydata['apresmidi'] = True mydata['apresmidi'] = True
elif (my_apresmidi == "0"): elif (my_apresmidi == "0"):
mydata['apresmidi'] = False mydata['apresmidi'] = False
"""
query_key = {} query_key = {}
query_key['email'] = mydata['email'] query_key['_id'] = ObjectId(str(diction['_id']))
query_key['session_id'] = mydata['session_id'] query_key['partner_owner_recid'] = str(partner_recid)
query_key['date'] = str(my_date)
query_key['class_internal_url'] = str(class_internal_url)
print(" #### query_key = ", query_key)
print(" #### mydata = ", mydata)
coll_emargement = MYSY_GV.dbname['emargement'] coll_emargement = MYSY_GV.dbname['emargement']
local_ret_val = coll_emargement.find_one_and_update( local_ret_val = coll_emargement.find_one_and_update(
@ -393,7 +547,7 @@ def UpdateUserEmargementDate(diction):
return_document=ReturnDocument.AFTER return_document=ReturnDocument.AFTER
) )
mycommon.myprint(str(inspect.stack()[0][3]) + " OK, la liste d'emargement de la session "+str( mydata['session_id'])+" a été mise à jour")
return True, "OK" return True, "OK"
except Exception as e: except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info() exc_type, exc_obj, exc_tb = sys.exc_info()
@ -468,7 +622,7 @@ def GerneratePDFEmargementList(diction):
print("### query_get_data = " + str(query_get_data)) print("### query_get_data = " + str(query_get_data))
tab_users = [] tab_users = []
for val_tmp in coll_emargement.find(query_get_data).sort([("date", pymongo.ASCENDING)]): for val_tmp in coll_emargement.find(query_get_data).sort([("date", pymongo.ASCENDING), ("sequence_start", pymongo.ASCENDING), ("sequence_end", pymongo.ASCENDING)]):
local_tmp = {} local_tmp = {}
local_tmp['email'] = val_tmp['email'] local_tmp['email'] = val_tmp['email']
local_tmp['nom'] = val_tmp['nom'] local_tmp['nom'] = val_tmp['nom']
@ -477,6 +631,11 @@ def GerneratePDFEmargementList(diction):
local_tmp['apresmidi'] = val_tmp['apresmidi'] local_tmp['apresmidi'] = val_tmp['apresmidi']
local_tmp['date'] = val_tmp['date'] local_tmp['date'] = val_tmp['date']
local_tmp['sequence_start'] = val_tmp['sequence_start']
local_tmp['sequence_end'] = val_tmp['sequence_end']
local_tmp['is_present'] = val_tmp['is_present']
tab_users.append(local_tmp) tab_users.append(local_tmp)
#print(' ### tab_users = ' + str(tab_users)) #print(' ### tab_users = ' + str(tab_users))

20
main.py
View File

@ -1905,6 +1905,26 @@ def CreateTableauEmargement():
localStatus, message= emargement.CreateTableauEmargement(payload) localStatus, message= emargement.CreateTableauEmargement(payload)
return jsonify(status=localStatus, message=message ) return jsonify(status=localStatus, message=message )
"""
Cette API Crée la liste d'emargement en partant des sequences déjà crée
23/11/2023 : Evolution en prenant les sequences.
Evolution de la fonction de création du tableau d'emargement.
Dans cette evolution, on plutot recuperer les sequence déjà créesq
"""
@app.route('/myclass/api/CreateTableauEmargement_From_Sequence/', methods=['POST','GET'])
@crossdomain(origin='*')
def CreateTableauEmargement_From_Sequence():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### CreateTableauEmargement_From_Sequence : payload = ",str(payload))
localStatus, message= emargement.CreateTableauEmargement_From_Sequence(payload)
return jsonify(status=localStatus, message=message )
""" """
API de recuperation du tableau d'emargement d'un session de formation API de recuperation du tableau d'emargement d'un session de formation
""" """

View File

@ -2778,10 +2778,7 @@ def UserEmargementValidation(diction):
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ") str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
return False, " Impossible de valider l'emargement" return False, " Impossible de valider l'emargement"
""" """
Si session == 1 => alors c'est l'emargement de la session du matin
Si session == 2 => alors c'est l'emargement de la session du apres midi
value = la valeur du "_id" de la ligne concernée value = la valeur du "_id" de la ligne concernée
""" """
@ -2792,7 +2789,7 @@ def UserEmargementValidation(diction):
ret_val = coll_emargement.find_one_and_update({'_id': ObjectId(str( diction['value']))}, ret_val = coll_emargement.find_one_and_update({'_id': ObjectId(str( diction['value']))},
{"$set": {"$set":
{"date_update": str(now), {"date_update": str(now),
'matin': True, 'is_present': True,
} }
}, },
return_document=ReturnDocument.AFTER return_document=ReturnDocument.AFTER
@ -2800,17 +2797,20 @@ def UserEmargementValidation(diction):
print(ret_val) print(ret_val)
elif (diction['session'] == "2"): """elif (diction['session'] == "2"):
print(" ### emargement l'apres midi") print(" ### emargement l'apres midi")
ret_val = coll_emargement.find_one_and_update({'_id': ObjectId(str(diction['value']))}, ret_val = coll_emargement.find_one_and_update({'_id': ObjectId(str(diction['value']))},
{"$set": {"$set":
{"date_update": str(now), {"date_update": str(now),
'apresmidi': True, 'is_present': True,
} }
}, },
return_document=ReturnDocument.AFTER return_document=ReturnDocument.AFTER
) )
print(ret_val) print(ret_val)
"""
return True, " Emargement ok " return True, " Emargement ok "