Example #1
0
def ticker(ticker_name):
    date = three_months_from_now()
    ticker = get_or_404(Ticker, name=ticker_name)
    history = History.query.filter(History.ticker_id == ticker.id,
                                   History.date >= date).all()
    history = [row.to_dict() for row in history]

    date_form = DateForm()
    if date_form.validate_on_submit():
        start_date = date_form.start_date.data
        end_date = date_form.end_date.data
        return redirect(
            url_for("analytics",
                    ticker_name=ticker_name,
                    date_from=start_date,
                    date_to=end_date))

    delta_form = DeltaForm()
    if delta_form.validate_on_submit():
        delta_val = delta_form.value.data
        delta_type = delta_form.type.data
        return redirect(
            url_for("delta",
                    ticker_name=ticker_name,
                    value=delta_val,
                    type=delta_type))

    return render_template("ticker_history.html",
                           ticker=ticker,
                           history=history,
                           date_form=date_form,
                           delta_form=delta_form)
Example #2
0
def get_date():
    form = DateForm()

    if form.validate_on_submit():
        #flash("Username is {}, date selected is {}".format(form.username.data, form.date.data))
        return redirect('/sobriety_date')
    return render_template('sobriety_date.html',
                           title="Get Sobriety Date",
                           form=form)
Example #3
0
def reviewer():
    reviews = Review.query.order_by(Review.id).filter(Review.status==1)
    print(reviews)
    form = DateForm()
    if form.validate_on_submit():
        print('+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++')
        print(form.date.data)
        #id = request.data
        print(form.id.data)
        print(form.submit)
        print('+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++')
        Review.change_status(2,form.id.data,current_user.id,User.get_name(current_user.id),form.date.data)
    return render_template('reviewer.html', reviews=reviews, form=form, rank=current_user.rank)
Example #4
0
def index():
    if not session.get('is_aunthenticate'):
        return redirect('/')
    form = DateForm()
    nombre = session.get('user_type')
    cursor = mysql.connection.cursor()
    date = datetime.now().strftime("%Y-%m-%d")
    if form.validate_on_submit():
        date = form.fecha.data
    cursor.execute(
        "SELECT p.cedula,p.nombre,p.apellido,u1.usuario,u2.usuario,ri.hora_entrada,ri.hora_salida,ri.equipo FROM registroinformacion AS ri JOIN persona AS p ON ri.id_persona = p.id JOIN usuarios AS u1 ON ri.id_usuario_entrada = u1.id JOIN usuarios AS u2 on ri.id_usuario_salida = u2.id WHERE ri.fecha_entrada = %s;",
        [
            date,
        ])
    history = cursor.fetchall()
    return render_template('index.html',
                           user=nombre,
                           history=history,
                           date=date,
                           form=form)
Example #5
0
def view_guest():
    if not session.get('is_aunthenticate'):
        return redirect('/')
    form = DateForm()
    nombre = session.get('user_type')
    cursor = mysql.connection.cursor()
    date = datetime.now().strftime("%Y-%m-%d")
    if form.validate_on_submit():
        date = form.fecha.data
    cursor.execute(
        "SELECT  nr.cedula, nr.nombre, nr.apellido, nr.motivo, nr.equipo, u.usuario, p.cedula, p.nombre, p.apellido, nr.hora_entrada, nr.hora_salida, nr.fecha_salida FROM noregistrado AS nr JOIN usuarios AS u ON nr.id_usuario = u.id JOIN persona AS p ON nr.id_persona = p.id WHERE nr.fecha_entrada = %s;",
        [
            date,
        ])
    history = cursor.fetchall()
    # select p.nombre, p.apellido, p.cedula,  u1.usuario as Entrada, u2.usuario as Salida, ri.fecha_entrada, ri.hora_entrada, ri.fecha_salida, ri.hora_salida, ri.equipo  from registroinformacion as ri join persona as p on ri.id_persona = p.id join usuarios as u1  on ri.id_usuario_entrada = u1.id join usuarios as u2 on ri.id_usuario_salida = u2.id;
    return render_template('view_guest.html',
                           user=nombre,
                           history=history,
                           date=date,
                           form=form)
Example #6
0
def choose_date():
	form = DateForm()
	if form.validate_on_submit():
		return redirect(url_for('game_select', year=form.dt.data.year, month=form.dt.data.month, day=form.dt.data.day))
	return render_template('choosedate.html', form=form)