Commit 3c13ecc2 authored by Antoine Kryus's avatar Antoine Kryus
Browse files

add correction python nb billets

parent 6e93b8bc
......@@ -49,7 +49,7 @@ while option != 0:
elif option == 6:
horaireSeance.execute(conn)
elif option == 7:
nbBilletPourUneSeance.nbBilletPourUneSeance(conn)
nbBilletPourUneSeance.execute(conn)
elif option == 8:
membreAssociation.execute(conn)
elif option == 9:
......
......@@ -4,15 +4,28 @@ import psycopg2
from tabulate import tabulate
def display(conn):
def execute(conn):
cur = conn.cursor()
column_names = []
data_rows = []
idSeance = input("Entrez l'id de la séance dont vous voulez connaitre le nombre de billets. \n")
# afficher la table Spectacle pour se repérer
print("\n")
sql = "SELECT idseance, horaire, 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))
idSeance = input("Entrez l'id de la séance dont vous voulez connaitre le nombre de billets : \n-> ")
sql = "SELECT COUNT(*) AS nbBillet FROM Billet WHERE seance = " + idSeance + ";"
print(sql)
#print(sql)
cur.execute(sql)
conn.commit()
#conn.commit()
print("\nIl y a %s billet(s) pour cette séance.\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