diff --git a/app/routes.py b/app/routes.py index fb8936a..7f2125b 100644 --- a/app/routes.py +++ b/app/routes.py @@ -3,11 +3,35 @@ from datetime import date from flask import render_template from app import app +def get_ride_data( basename ): + ##TODO: process just first line if file just has one line (treats) + try: + next_ride_file = open( getcwd() + sep + "data/"+date.strftime(basename,"%Y-%m-%d")+".txt") + lines = [ line for line in next_ride_file.read().split("\n") ] + next_ride_object = { + "treats": lines[0].split(","), + lines[1].split(",")[0]:lines[1].split(",")[1], + lines[2].split(",")[0]:lines[2].split(",")[1], + lines[3].split(",")[0]:lines[3].split(",")[1], + lines[4].split(",")[0]:lines[4].split(",")[1], + lines[5].split(",")[0]:lines[5].split(",")[1], + lines[6].split(",")[0]:lines[6].split(",")[1], + lines[7].split(",")[0]:lines[7].split(",")[1], + lines[8].split(",")[0]:lines[8].split(",")[1], + "winner1":list(lines[9].split(",")), + "winner2":list(lines[10].split(",")), + "winner3":list(lines[11].split(",")), + } + except: + next_ride_object = None + + + file = next_ride_object + return file def get_rides(): rides_file = open( getcwd() + sep + "data/rides.txt") rides = [ date.strptime( ride_date_str ,"%Y/%m/%d") for ride_date_str in rides_file.read().split("\n") ] return rides - def get_next_ride_date( rides_list ): rides_list.sort() active_rides = [] @@ -16,22 +40,22 @@ def get_next_ride_date( rides_list ): active_rides.append( ride_date ) next_ride = active_rides[0] return next_ride - def get_week_day_name( a_date ): return date.strftime( a_date ,"%A, %B %d" ) - def get_short_day_name_and_date( a_date ): return date.strftime( a_date ,"%b %d" ) @app.route('/') @app.route('/index') +@app.route('/home') def index(): - + rides = get_rides() next_ride = get_next_ride_date(rides) user = {'username': 'Jorge'} month_and_day = get_week_day_name( next_ride ) short_day_name_and_date = get_short_day_name_and_date( next_ride ) + next_ride_data = get_ride_data( next_ride ) posts = [ { 'author': {'username':'Guybrush'}, @@ -43,4 +67,13 @@ def index(): } ] - return render_template( 'index.html', title='Home', user=user, posts=posts, rides=rides, month_and_day=month_and_day, short_day_name_and_date=short_day_name_and_date, next_ride=next_ride) ## objects/variables to send over to templates. + return render_template( 'index.html', next_ride_data=next_ride_data, title='Home', user=user, posts=posts, rides=rides, month_and_day=month_and_day, short_day_name_and_date=short_day_name_and_date, next_ride=next_ride) ## objects/variables to send over to templates. + +@app.route('/ride') +@app.route('/walk') +def ride(): + rides = get_rides() + next_ride = get_next_ride_date(rides) + next_ride_data = get_ride_data( next_ride ) + + return render_template( 'ride.html', rides=rides, next_ride_data=next_ride_data, title='Home', next_ride=next_ride) ## objects/variables to send over to templates. diff --git a/app/static/img/map_v2.svg b/app/static/img/map_v2.svg index 371f6f5..43326e4 100755 --- a/app/static/img/map_v2.svg +++ b/app/static/img/map_v2.svg @@ -23,7 +23,7 @@ inkscape:deskcolor="#d1d1d1" inkscape:document-units="pt" inkscape:zoom="0.45254834" - inkscape:cx="1334.664" + inkscape:cx="1333.5592" inkscape:cy="536.95921" inkscape:window-width="2560" inkscape:window-height="1440" @@ -22425,7 +22425,8 @@ onmouseout="this.style="filter: drop-shadow(0 0 0 ffffff00 );""> + inkscape:current-layer="logo1" + showgrid="false" /> + id="logo1" + transform="translate(27.516669,-2.6458339)" + style="display:inline"> walk Roller @@ -82,7 +86,7 @@ style="font-weight:bold;font-size:59.2235px;line-height:0.73;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';text-align:center;text-anchor:middle;mix-blend-mode:normal;fill:#ffffff;fill-opacity:0.929412;stroke:none;stroke-width:13.9221;stroke-linecap:square;paint-order:markers fill stroke" x="204.95403" y="118.33827" - id="text1-6-3" + id="and" inkscape:label="&" transform="scale(1.0000915,0.99990852)"> diff --git a/app/templates/index.html b/app/templates/index.html index 780b9fe..18462ed 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -16,8 +16,11 @@
-

- We'll have delicious treats for all of you at the front gate!!! +

{% if next_ride_data == None %} + We'll have delicious treats for all of you at the front gate!!! + {% else %} + We'll have delicious {{ next_ride_data.treats[0]+" and "+next_ride_data.treats[1]+" "}} for all of you at the front gate!!! + {% endif %}

diff --git a/app/templates/ride.html b/app/templates/ride.html new file mode 100644 index 0000000..72d823d --- /dev/null +++ b/app/templates/ride.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} +{% block content %} + +

143 of you participated

+

...kids from all grades and ages, walking, biking, scooting, and skating.

+ +

CHECK YOUR TAGS FOR THE RAFFLE WINNING NUMBERS...

+ +

... and claim your gift certificate for special prizes.

+

CONGRATULATIONS TO Señor Reyes' 3rd grade class

+

All clases did put an incredible showing and SeñorX Reyes' 3rd grade class won the silver Sneaker Award for the class with more participation.

+

Hello, {{ rides }}!

+{% endblock %} + diff --git a/data/2026-11-06.txt b/data/2026-11-06.txt new file mode 100644 index 0000000..4b70f5e --- /dev/null +++ b/data/2026-11-06.txt @@ -0,0 +1,12 @@ +hot chocolate,churros +total,112 +k,21 +1,29 +2,11 +3,15 +4,15 +5,15 +most_part,Nagumo Sensei +15949, Miyawaki Sensei +15626, Oda Sensei +15766, Señora Aguila \ No newline at end of file