Lukeetah commited on
Commit
922efad
1 Parent(s): 2699a25

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -17,7 +17,7 @@ c = conn.cursor()
17
 
18
  # Crear tabla si no existe
19
  c.execute('''CREATE TABLE IF NOT EXISTS resultados
20
- (nombre text, milei real, bullrich real, massa real, schiaretti real, bregman real)''')
21
 
22
  # Diccionario para almacenar las votaciones
23
  votaciones = {}
@@ -43,9 +43,9 @@ if nombre_votante:
43
  confirmado = st.button("Votar")
44
  if confirmado:
45
  # Guardar resultados en la base de datos
46
- c.execute('INSERT INTO resultados VALUES (?, ?, ?, ?, ?, ?)',
47
  (nombre_votante, porcentajes["Javier Milei"], porcentajes["Patricia Bullrich"],
48
- porcentajes["Sergio Massa"], porcentajes["Juan Schiaretti"], porcentajes["Myriam Bregman"]))
49
  conn.commit()
50
  votaciones[nombre_votante] = porcentajes
51
  st.write(f"Gracias {nombre_votante}!")
@@ -62,7 +62,7 @@ if st.button("Resultados"):
62
  st.write("Resultados actuales:")
63
  for resultado in resultados:
64
  st.write(f'{resultado[0]}:')
65
- for i, candidato in enumerate(candidatos[1:]): # Excluye "Votos en blanco / impugnados" de la iteración
66
  st.write(f'{candidato}: {resultado[i + 1]}%')
67
  # Botón para volver
68
  if st.button("< Volver"):
 
17
 
18
  # Crear tabla si no existe
19
  c.execute('''CREATE TABLE IF NOT EXISTS resultados
20
+ (nombre text, milei real, bullrich real, massa real, schiaretti real, bregman real, blanco real)''')
21
 
22
  # Diccionario para almacenar las votaciones
23
  votaciones = {}
 
43
  confirmado = st.button("Votar")
44
  if confirmado:
45
  # Guardar resultados en la base de datos
46
+ c.execute('INSERT INTO resultados VALUES (?, ?, ?, ?, ?, ?, ?)',
47
  (nombre_votante, porcentajes["Javier Milei"], porcentajes["Patricia Bullrich"],
48
+ porcentajes["Sergio Massa"], porcentajes["Juan Schiaretti"], porcentajes["Myriam Bregman"], porcentajes["Votos en blanco / impugnados"]))
49
  conn.commit()
50
  votaciones[nombre_votante] = porcentajes
51
  st.write(f"Gracias {nombre_votante}!")
 
62
  st.write("Resultados actuales:")
63
  for resultado in resultados:
64
  st.write(f'{resultado[0]}:')
65
+ for i, candidato in enumerate(candidatos):
66
  st.write(f'{candidato}: {resultado[i + 1]}%')
67
  # Botón para volver
68
  if st.button("< Volver"):