Exemple #1
0
import cgi
import cgitb

from templates import yate

cgitb.enable()

form_data = cgi.FieldStorage()

athlete_ID = form_data['ID'].value

print(yate.start_response())

print(yate.include_header("Introducir el nueovo tiempo"))

print(yate.start_form("AnadirTiempoDDBB.py"))

print(yate.para("Añadir tiempo para el atleta con ID: {}".format(athlete_ID)))

print(yate.text_field("tiempo", "Introducir Tiempo"))

print(yate.hidden_input("ID", athlete_ID))

print(yate.end_form("Aceptar"))

print(yate.include_footer({"Indice": "/cgi-bin/indice.py"}))
Exemple #2
0
import glob

from lib import athletemodel
from templates import yate

data_files = glob.glob("data/*.txt")
athletes_info = athletemodel.get_namesID_from_store()

print(yate.start_response())

print(yate.include_header("Coach Martin's List of Athletes"))

print(yate.start_form("adding_time.py"))

print(yate.para("Select an athlete from the list to add time:"))
for each_athlete in athletes_info:
    print(
        yate.radio_button("which_athlete", each_athlete['name'],
                          each_athlete['ID']))

print(yate.text_field("athlete_new_time", "athlete_new_time"))

print(yate.end_form("Select"))

print(
    yate.include_footer({
        "Home": "/index.html",
        "Show timing athlete": "generate_list.py"
    }))
Exemple #3
0
from templates import yate
from images import GeneradorGraficas

cgitb.enable()

form_data = cgi.FieldStorage()
athlete_ID = form_data['ID'].value

athlete_info = athletemodel.get_athlete_from_id(athlete_ID)

print(yate.start_response())

print(yate.start_form("ConfirmarBorrado.py"))

print(yate.include_header("Tiempos para " + athlete_info['Name']))

print(yate.para("Seleccionar la marca que se quiere borrar:"))

for data in athlete_info['data']:
    print(yate.radio_button("Tiempo", "", data))

print(yate.hidden_input("ID", athlete_ID))

print(yate.end_form("Aceptar"))

print(
    yate.include_footer({
        "Seleccinar otro atleta":
        "/cgi-bin/BorrarTiempoAtleta/MostrarySeleccionarAtleta.py"
    }))
print(yate.include_footer({"Indice": "/cgi-bin/indice.py"}))
Exemple #4
0
'''
Created on 13 may. 2016

@author: Manuel
'''
import glob

from lib import athletemodel
from templates import yate

data_files = glob.glob("data/*.txt")
athletes_info = athletemodel.get_namesID_from_store()

print(yate.start_response())

print(yate.include_header("Registro de atletas"))

print(yate.start_form("generate_timing_data.py"))

print(yate.para("Selecciona el atleta del cual deseas ver los tiempos:"))
for each_athlete in athletes_info:
    print(yate.radio_button("ID", each_athlete['name'], each_athlete['ID']))

print(yate.end_form("Aceptar"))

print(yate.include_footer({"Indice": "/cgi-bin/indice.py"}))
Exemple #5
0
'''
Created on 25 Enero. 2017

@author: jkmrto
'''
import cgi
import cgitb

from lib import athletemodel
from templates import yate
cgitb.enable()

form_data = cgi.FieldStorage()
athlete_ID = form_data['ID'].value
Tiempo = form_data['Tiempo'].value

athlete_info = athletemodel.get_athlete_from_id(athlete_ID)

print(yate.start_response())
print(yate.include_header("Borrando la  marca {0}"
                          " para el atleta {1}".format(Tiempo, athlete_info['Name'])))
try:
    athletemodel.BorraTiempoAtleta(athlete_ID, Tiempo)
    print(yate.para(" El borrado se ha relizado correctamente"))
except Exception as e:
    print(yate.para("Error borrando el dato:" + str(e)))



print(yate.include_footer({"Indice": "/index.html"}))
Exemple #6
0
import cgi
import cgitb

from lib import athletemodel
from templates import yate

cgitb.enable()

form_data = cgi.FieldStorage()

athlete_ID = form_data['which_athlete'].value
athlete_new_time = form_data['athlete_new_time'].value

print(yate.start_response())

print(yate.include_header("Coach Martin's List of Athletes"))

try:
    athletemodel.add_new_time_to_athelte(athlete_ID, athlete_new_time)
    print(
        yate.para("New time: {0} added correctly to athleteID: {1}".format(
            athlete_new_time, athlete_ID)))
except Exception as e:
    print(yate.para("Error adding new time" + str(e)))

print(
    yate.include_footer({
        "Home": "/index.html",
        "Add timing to athlete": "add_time_form.py",
        "Show time of athlete": ""
    }))
Exemple #7
0
@author: Manuel
'''
import cgi
import cgitb

from lib import athletemodel
from templates import yate
from images.GeneradorGraficas import GenerarGraficasTiempos

cgitb.enable()

form_data = cgi.FieldStorage()
athlete_ID = form_data['ID'].value

athlete_info = athletemodel.get_athlete_from_id(athlete_ID)

print(yate.start_response())

print(yate.include_header("Datos de tiempo para: " + athlete_info['Name']))

print(yate.para("The top times for this athlete are:"))
print(yate.u_list(athlete_info['top3']))

GenerarGraficasTiempos(athlete_info, "images/tiempos.png")

print(yate.para("Grafica de Evolucion de sus tiempos:"))
print(yate.simple_plot("/images/tiempos.png"))

print(yate.include_footer({"Indice": "/cgi-bin/indice.py"}))
print(yate.include_footer({"Seleccionar otro atleta": "generate_list.py"}))
Exemple #8
0
'''
Created on 13 may. 2016

@author: jkmrto
'''
import glob

from lib import athletemodel
from templates import yate

data_files = glob.glob("data/*.txt")
athletes_info = athletemodel.get_namesID_from_store()

print(yate.start_response())

print(yate.include_header("Lista actual de atletas"))

print(yate.start_form("ConfirmarBorrado.py"))

print(yate.para("Seleccionar el atleta que se quiere borrar:"))

for each_athlete in athletes_info:
    print(yate.radio_button("ID", each_athlete['name'], each_athlete['ID']))

print(yate.end_form("Aceptar"))

print(yate.include_footer({"Indice": "/index.html"}))

Exemple #9
0
'''
Created on 13 may. 2016

@author: jkmrto
'''
import glob

from lib import athletemodel
from templates import yate

data_files = glob.glob("data/*.txt")
athletes_info = athletemodel.get_namesID_from_store()

print(yate.start_response())

print(yate.include_header("Lista actual de atletas"))

print(yate.start_form("MostrarYseleccionarTiempo.py"))

print(yate.para("Seleccionar el atleta de la lista del cual se quiere borrar un tiempo:"))

for each_athlete in athletes_info:
    print(yate.radio_button("ID", each_athlete['name'], each_athlete['ID']))

print(yate.end_form("Aceptar"))

print(yate.include_footer({"Indice": "/index.html"}))

Exemple #10
0
    'tiempo1', 'tiempo2', 'tiempo3', 'tiempo4', 'tiempo5', 'tiempo6',
    'tiempo7', 'tiempo8', 'tiempo9', 'tiempo10'
]

TiemposIndicados = []
for EtiquetaEvaluada in EtiquetasTiempo:
    try:
        ValorNumerico = ObtenerValorNumericoSiEsPosible(
            form_data[EtiquetaEvaluada].value)
        if isinstance(ValorNumerico, float):
            TiemposIndicados.append(ValorNumerico)
    except:
        pass

print(yate.start_response())

ID_asignado = athletemodel.AnadirAthleteDDBB(nombre)
print(
    yate.header("Añadido el atleta {0} con ID {1}".format(nombre,
                                                          ID_asignado)))

for tiempo in TiemposIndicados:

    try:
        athletemodel.add_new_time_to_athelte(ID_asignado, tiempo)
        print(yate.para("Tiempo {} añadido correctamente".format(tiempo)))
    except:
        print(yate.para("Error añadiento el tiempo {}".format(tiempo)))

print(yate.include_footer({"Indice": "/cgi-bin/indice.py"}))
Exemple #11
0
import glob

from lib import athletemodel
from templates import yate

data_files = glob.glob("data/*.txt")
athletes_info = athletemodel.get_namesID_from_store()

print(yate.start_response())

print(yate.include_header("Lista de Atletas:"))

print(yate.start_form("IndicarTiempo.py"))

print(yate.para("Seleccionar atleta al cual añadir el tiempo:"))
for each_athlete in athletes_info:
    print(yate.radio_button("ID", each_athlete['name'], each_athlete['ID']))

print(yate.end_form("Acepar"))

print(yate.include_footer({"Indice": "/cgi-bin/indice.py"}))



Exemple #12
0
import cgi
import cgitb

from lib import athletemodel
from templates import yate

cgitb.enable()

form_data = cgi.FieldStorage()

athlete_ID = form_data['ID'].value
new_time = form_data['tiempo'].value

print(yate.start_response())

yate.para(new_time + athlete_ID)
print(
    yate.include_header("Insertando el tiempo {0} del atleta {1}".format(
        new_time, athlete_ID)))

try:
    athletemodel.add_new_time_to_athelte(athlete_ID, new_time)
    print(
        yate.para(
            "Nuevo tiempo: {0} insertado correctametne al atleta con ID: {1}".
            format(new_time, athlete_ID)))
except Exception as e:
    print(yate.para("Error añadiendo el nuevo tiempo" + str(e)))

print(yate.include_footer({"Indice": "/cgi-bin/indice.py"}))