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 );"">
...kids from all grades and ages, walking, biking, scooting, and skating.
+... and claim your gift certificate for special prizes.
+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.
+