1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
| def eleveAutorise(login):
conn = connexionBD()
cursor = conn.cursor()
cursor.execute("SELECT categorie_id FROM compte c,categorie ca where c.categorie_id=ca.id and libelle_cat=%s and login=%s", ('eleve',login))
row = cursor.fetchone ()
if (row == None):
return 1
else:
cursor.execute("SELECT c.idEta FROM compte c ,etablissement e where c.idEta=e.idEta and e.nomEta=%s and login=%s", ('Lnlm', login))
row1 = cursor.fetchone ()
if (row1 != None):
cursor.execute("SELECT c.idclass FROM compte c,classe cl where c.idclass=cl.idClass and c.idEta=%s and login=%s", (row1[0], login))
row2 = cursor.fetchone ()
jours = ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"]
j= jours[time.localtime()[6]]
cursor.execute("SELECT * FROM emploi_du_temps where idClass=%s and jour=%s",(row2[0],j))
row3 = cursor.fetchone ()
conn.close()
from datetime import datetime
#datetime(2000, 1, 1)
maintenant = datetime.now()
if((maintenant.hour >7 and maintenant.minute<=30) and (maintenant.hour<8 and maintenant.minute<=20)):
if(row3[2]=="L"):
return 1
else:
return 0
else:
if((maintenant.hour >8 and maintenant.minute<=20) and (maintenant.hour<9 and maintenant.minute<=20)):
if(row3[3]=="L"):
return 1
else:
return 0
else:
if((maintenant.hour >9 and maintenant.minute<=20) and (maintenant.hour<10 and maintenant.minute<=10)):
if(row3[4]=="L"):
return 1
else:
return 0
else:
if((maintenant.hour >10 and maintenant.minute<=10) and (maintenant.hour<11 and maintenant.minute<=5)):
if(row3[5]=="L"):
return 1
else:
return 0
else:
if((maintenant.hour >11 and maintenant.minute<=05) and (maintenant.hour<11 and maintenant.minute<=30)):
if(row3[6]=="L"):
return 1
else:
return 0
else:
if((maintenant.hour >11 and maintenant.minute<=30) and (maintenant.hour<12 and maintenant.minute<=20)):
if(row3[7]=="L"):
return 1
else:
return 0
else:
if((maintenant.hour >12 and maintenant.minute<=20) and (maintenant.hour<13 and maintenant.minute<=15)):
if(row3[8]=="L"):
return 1
else:
return 0
else:
if((maintenant.hour >13 and maintenant.minute<=15) and (maintenant.hour<15 and maintenant.minute<=00)):
if(row3[9]=="L"):
return 1
else:
return 0
else:
if((maintenant.hour >15 and maintenant.minute<=00) and (maintenant.hour<16 and maintenant.minute<=00)):
if(row3[10]=="L"):
return 1
else:
return 0
else:
if((maintenant.hour >16 and maintenant.minute<=00) and (maintenant.hour<17 and maintenant.minute<=00)):
if(row3[11]=="L"):
return 1
else:
return 0
else:
return 1 |
Partager