Commit 605c1481 authored by Antoine Kryus's avatar Antoine Kryus
Browse files

add correction python horaire seance

parent f63707d6
......@@ -2,15 +2,27 @@ import psycopg2
from tabulate import tabulate
def display(conn):
def execute(conn):
cur = conn.cursor()
column_names = []
data_rows = []
seance = input("Entrez l'id de la séance dont vous voulez connaitre l'horaire. \n")
# afficher la table Spectacle pour se repérer
print("\n")
sql = "SELECT idseance, salle, spectacle, type, duree, anneedeparution FROM Seance S JOIN Spectacle Sp ON S.spectacle=Sp.idspectacle;"
cur.execute(sql)
nb_field = len(cur.description)
column_names = [desc[0] for desc in cur.description]
for row in cur:
data_rows.append(row)
print (tabulate(data_rows, headers=column_names))
seance = input("Entrez l'id de la séance dont vous voulez connaitre l'horaire : \n-> ")
sql = "SELECT horaire FROM Seance WHERE idseance = " + seance + ";"
print(sql)
#print(sql)
cur.execute(sql)
conn.commit()
#conn.commit()
print("\nCette séance est à %s.\n\n" % str(cur.fetchone()[0])[:5])
......@@ -47,7 +47,7 @@ while option != 0:
elif option == 5:
nbSeanceParSpectacle.execute(conn)
elif option == 6:
horaireseance.horaireSeance(conn)
horaireSeance.execute(conn)
elif option == 7:
nbBilletPourUneSeance.nbBilletPourUneSeance(conn)
elif option == 8:
......
......@@ -26,5 +26,5 @@ def execute(conn):
sql = "SELECT COUNT(*) AS idseance FROM Seance WHERE spectacle = " + spectacle + ";"
#print(sql)
cur.execute(sql)
conn.commit()
#conn.commit()
print("\nIl y a %s séance(s) pour ce spectacle.\n\n" % str(cur.fetchone()[0]))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment