Added a data/rides/ folder that includes the text file for each ride with its info. Started working on the ride section, pulling info from the ride's text file.

This commit is contained in:
2026-10-23 19:40:27 -07:00
parent b68ebe7475
commit 51b164f589
8 changed files with 229 additions and 119 deletions
+72 -31
View File
@@ -3,32 +3,53 @@ from datetime import date
from flask import render_template
from app import app
def get_ride_data( basename ):
class Raffle_Winner():
def __init__(self, the_number,the_teacher,the_grade):
self.number = the_number
self.teacher = the_teacher
self.grade = the_grade
class Participants():
total = tk = k = g1 = g2 = g3 = g4 = g5 = 0
class Ride():
date = None
treats = []
participants = Participants()
classroom = None
raffle_winners = []
def get_ride_data( a_date ):
##TODO: process just first line if file just has one line (treats)
r = Ride()
try:
next_ride_file = open( getcwd() + sep + "data/"+date.strftime(basename,"%Y-%m-%d")+".txt")
next_ride_file = open( getcwd() + sep + "data/rides/"+date.strftime(a_date,"%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(",")),
}
if len(lines) > 1:
r.treats = list( lines[0].split(",") )
r.participants.total = lines[1].split(",")[1]
r.participants.tk = lines[2].split(",")[1]
r.participants.k = lines[3].split(",")[1]
r.participants.g1 = lines[4].split(",")[1]
r.participants.g2 = lines[5].split(",")[1]
r.participants.g3 = lines[6].split(",")[1]
r.participants.g4 = lines[7].split(",")[1]
r.participants.g5 = lines[8].split(",")[1]
r.classroom = list( lines[9].split(",")[1:3] )
r.raffle_winners = []
tmp_list = list(lines[10].split(","))
for w in tmp_list:
winner_data = list(w.split("-"))
r.raffle_winners.append( Raffle_Winner(winner_data[0],winner_data[1],winner_data[2]))
elif len(lines) == 1:
r.treats = list( lines[0].split(",") )
except:
next_ride_object = None
pass
file = next_ride_object
return file
def get_rides():
##file = next_ride_object
return r
def get_rides_dates():
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
@@ -40,21 +61,40 @@ 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" )
def get_rides_data( dates ):
n = 0
rides_files = []
rides_data = []
for d in dates:
data = Ride()
data.date = d
data.treats = []
data.participants.total = 0
data.participants.tk = 0
data.participants.k = 0
data.participants.g1 = 0
data.participants.g2 = 0
data.participants.g3 = 0
data.participants.g4 = 0
data.participants.g5 = 0
data.classroom = None
data.raffle_winners = []
rides_data.append( data )
return rides_data
@app.route('/')
@app.route('/index')
@app.route('/home')
def index():
rides = get_rides()
rides = get_rides_dates()
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 )
month_and_day = date.strftime( next_ride ,"%A, %B %d" )
short_day_name_and_date = date.strftime( next_ride ,"%b %d" )
next_ride_data = get_ride_data( next_ride )
posts = [
{
@@ -72,8 +112,9 @@ def index():
@app.route('/ride')
@app.route('/walk')
def ride():
rides = get_rides()
next_ride = get_next_ride_date(rides)
rides_dates = get_rides_dates()
next_ride = get_next_ride_date( rides_dates )
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.
rides_data = get_rides_data( rides_dates )
x = get_ride_data( next_ride )
return render_template( 'ride.html', x=x, rides_data=rides_data, rides_dates=rides_dates, next_ride_data=next_ride_data, title='Home', next_ride=next_ride) ## objects/variables to send over to templates.
+75 -50
View File
@@ -23,12 +23,31 @@
--wr-yellow:#e8d55d;
--wr-yellow-filter:filter: invert(77%) sepia(30%) saturate(679%) hue-rotate(12deg) brightness(101%) contrast(98%);
--wr-black:#0c1625;
--wr-border-radius: 1.25em;
--wr-widget-height: 1.5em;
--wr-active-widget-height: 2em;
--heart: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path fill='currentColor' d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/></svg>");
--arrow_before: url(/static/img/arrow_before.svg);
--arrow_after: url(/static/img/arrow_after.svg);
--min_width_mobile: 500px;
--wr-h-letter-spacing: -.075em;
--wr-border-radius: 1.25em;
--wr-widget-height: 1.5em;
--wr-active-widget-height: 2em;
@media screen and ( width > 500px ) {
--wr-html-font-size: 1.25em;
--wr-background-size: 12em;
--wr-h1-font-size:2.25em;
--wr-h3-font-size:1.5em;
--wr-emwrlogo-max-height:13em;
--wr-widget-scale: 1;
}
@media screen and ( width <= 500px ) {
--wr-html-font-size: var(.125em);
--wr-background-size: 10em;
--wr-h1-font-size:1.75em;
--wr-h3-font-size:1em;
--wr-emwrlogo-max-height:8em;
--wr-widget-scale: .75;
}
}
/*Fonts*/
@font-face {
@@ -50,59 +69,56 @@ html,body{
padding: 0px;
line-height: .95;
scroll-behavior:smooth;
transition: all 1s ease-out;
/* transition: all 1s ease-out; */
}
html{
font-family: abelRegular;
font-size: 1.25em;
font-size: var(--wr-html-font-size);
}
body{
background-color: var(--violet-main-color);
background-image: url("./img/pattern.svg");
background-attachment: fixed;
background-size: 12em;
background-size: var(--wr-background-size);
max-width: 100%;
display: flex;
flex-direction: column;
}
h1,h3{
letter-spacing: -.075em;
letter-spacing: var(--wr-h-letter-spacing);
color: var(--wr-yellow);
padding-top: 0px;
margin-top: 0px;
margin-bottom: 0px;
}
h1{
font-size: 2.25em;
font-size: var(--wr-h1-font-size);
}
h3{
font-size: 1.5em;
font-size: var(--wr-h3-font-size);
}
img{
max-width: 100%;
}
/*Useful Layout Classes*/
div.page{
display: flex;
justify-content: center;
align-items: center;
max-width: 100%;
}
div.container{
display: flex;
flex-direction: column;
max-width: 40em;
align-items:center;
}
.section{
height: 100vh;
/* background-color: #d5231133;
@@ -110,37 +126,57 @@ div.container{
border-width: 1px; */
/*scale: .75;*/
}
.row{
display: flex;
flex-direction: row;
}
.column{
display: flex;
flex-direction: column;
}
.wrapping{
flex-wrap: wrap;
}
.centered{
display: flex;
justify-content: center;
align-items: center;
}
.box{
padding-top: 1em;
padding-bottom: 1em;
padding-left: 1.5em;
padding-right: 1.5em;
margin-left:2em;
margin-right:2em;
margin-top: 0px;
margin-bottom: 0px;
@media screen and ( width <= 500px ) {
.box{
padding-top: .5em;
padding-bottom: .5em;
padding-left: .75em;
padding-right: .75em;
margin-left: 1em;
margin-right:1em;
margin-top: 0px;
margin-bottom: 0px;
}
}
@media screen and ( width >= 500px) {
.box{
padding-top: 1em;
padding-bottom: 1em;
padding-left: 1.5em;
padding-right: 1.5em;
margin-left:2em;
margin-right:2em;
margin-top: 0px;
margin-bottom: 0px;
}
}
.box.left{
margin-right: 0px;
}
.box.right{
margin-left: 0px;
}
.big{
font-size: +3em;
letter-spacing: -.1em;
}
/* .box:hover{
padding-top: 5em;
} */
@@ -154,11 +190,11 @@ div.container{
}
.menu{
scale: var(--wr-widget-scale);
position: absolute;
top: 0em;
justify-content: center;
}
.section{
padding: 0px;
margin: 0px;
@@ -204,68 +240,59 @@ div.container{
}
/*Images*/
a.menuitem{
padding-left: 1em;
padding-right: 1em;
}
img.icon{
img.icon,object.icon{
display: block;
max-width: 100%;
max-height: 3em;
border-radius: 0em;
padding: .5em;
}
img.emwrlogo{
max-height: 13em;
max-height: var(--wr-emwrlogo-max-height);
background-size: cover;
background-image: url('/static/img/backpack_purple.webp');
position: relative;
margin-bottom:1em;
}
object.map{
max-width: 100%;
border-radius: var(--wr-border-radius);
}
img.photo{
padding: .25em;
height: 12em;
object-fit: cover;
border-radius: var(--wr-border-radius);
}
img.photo.main{
width: 100%;
height: auto;
}
img.photo.A{
width: 12em;
}
img.photo.B{
width: 18em;
}
img.photo.C{
width: 8em;
}
/*Colors*/
.yellow{
color: var(--wr-yellow);
}
/* Classes */
.ccwr_url{
background-color: #390747;
}
/*?*/
.ride_date{
display: block;
padding: .5em;
@@ -273,15 +300,12 @@ img.photo.C{
letter-spacing: -.075em;
color: var(--wr-white);
}
.next_ride_date{
color:var(--wr-yellow);
}
.ride_date.active{
color: var(--wr-dark-blue);
}
div.tag_reminder{
position: fixed;
overflow-y: scroll;
@@ -289,7 +313,9 @@ div.tag_reminder{
top: 1em;
right: 1em;
}
.hide{
display: none;
}
.widget{
color:var(--wr-white);
height: var(--wr-widget-height);
@@ -303,7 +329,6 @@ div.tag_reminder{
.widget:hover{
cursor: pointer;
}
.widget-text{
display: flex;
height: var(--wr-widget-height);
@@ -321,19 +346,19 @@ div.tag_reminder{
color: var(--wr-yellow);
font-size: 1em;
}
.backpack{
max-height: 15em;
width: auto;
}
p{
padding-top: 0px;
margin-top: .5em;
margin-bottom: 0px;
}
/* IDs */
#dates_bar{
scale: var(--wr-widget-scale);
bottom: 0px;
justify-content: center;
overflow-y: scroll;
+2 -2
View File
@@ -11,7 +11,7 @@
{% endif %}
</head>
<body>
<svg viewBox="0 0 128 256">
<svg class="hide" viewBox="0 0 128 256">
<symbol id="arrow_before">
<path
d="M 9.6068084,0 C 1.8663641,0 -2.6841705,8.6955634 1.7265221,15.054622 L 69.625489,112.94519 c 6.27777,9.05424 6.27777,21.05576 0,30.10962 L 1.7265221,240.94538 C -2.6841705,247.30444 1.8777027,256 9.6068084,256 H 128.00008 V 0 Z"
@@ -19,7 +19,7 @@
id="path1" />
</symbol>
</svg>
<svg viewBox="0 0 128 256">
<svg class="hide" viewBox="0 0 128 256">
<symbol id="arrow_after">
<path
d="m 0,0 v 256 h 26.617773 c 11.476459,0 22.224187,-5.62496 28.765566,-15.05469 l 67.906281,-97.89068 c 6.28051,-9.05389 6.28051,-21.05544 0,-30.10934 L 55.383339,15.05469 C 48.84196,5.6249614 38.09427,7.5590553e-5 26.617773,3.7795277e-6 Z"
+3 -2
View File
@@ -33,6 +33,7 @@
</map>
<h3>Starting Locations</h3>
<object class="map" data="/static/img/map_v2.svg" type="image/svg+xml">
<span>Your browser doesn't support SVG images</span>
</object>
@@ -93,11 +94,11 @@
</div>
</div>
<div class="anchor_right fix">
<div class="hide anchor_right fix">
<img class="icon" src="/static/img/keychain.webp">
</div>
<div class="tag_reminder">
<div class="hide tag_reminder">
<div class="row centered">
<div class="row box ">
<img class="icon" src="/static/img/wr_phone.svg">
+55 -22
View File
@@ -1,26 +1,59 @@
{% extends "base.html" %}
{% block content %}
<object data="/static/img/wr_logo.svg"></object>
<h1><span>143</span> of you participated</h1>
<p>...kids from all grades and ages, walking, biking, scooting, and skating.</p>
<ul>
<li>TK,7</li>
<li>K,27</li>
<li>1st,26</li>
<li>2nd,19</li>
<li>3rd,27</li>
<li>4th,21</li>
<li>5th,16</li>
</ul>
<h3>CHECK YOUR TAGS FOR THE RAFFLE WINNING NUMBERS...</h3>
<ul>
<li>15074 - Nicodemus</li>
<li>15000 - Mizuta</li>
<li>15105 - Rodriguez</li>
</ul>
<p>... and claim your gift certificate for special prizes.</p>
<h3>CONGRATULATIONS TO Señor Reyes' 3rd grade class</h3>
<p>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.</p>
<h1>Hello, {{ rides }}!</h1>
<div class="page">
<div class="container">
<div class="column">
<object class="icon" data="/static/img/wr_logo.svg"></object>
<div style="display: flex;">
<div class="box left solid">
<h1><span class="big">{{ x.participants.total }}</span> <br> of you participated</h1>
<p>...kids from all grades and ages, walking, biking, scooting, and skating.</p>
</div>
<div styclass="box right solid">
{% for g in [
["TK",x.participants.tk],
["K",x.participants.k],
["1st",x.participants.g1],
["2nd",x.participants.g2],
["3rd",x.participants.g3],
["4th",x.participants.g4],
["5th",x.participants.g5]
] %}
<div style="padding: .35em;" class="widget ride_date active centered">
<div class="row centered"> {{ g[0] }}
<svg style="width:100%;height: 2em" viewBox="0 0 128 256"><use href="#arrow_before" opacity="1.0" /></svg>
<div class="widget-text active centered">{{ g[1] }}</div>
<svg style="width:100%;height: 2em;" viewBox="0 0 128 256"><use href="#arrow_after" opacity="1.0" /></svg>
</div>
</div>
{% endfor %}
</div>
</div>
<div class="box solid">
<h3>CHECK YOUR TAGS FOR THE RAFFLE WINNING NUMBERS...</h3>
<ul>
{% for w in x.raffle_winners %}
<li>{{ w.number }} - {{ w.teacher }}</li>
{% endfor %}
</ul>
<p>... and claim your gift certificate for special prizes.</p>
</div>
<div class="box solid">
<h3>CONGRATULATIONS TO Señor Reyes' 3rd grade class</h3>
<p>All clases did put an incredible showing and {{ x.classroom[0]+"' "+x.classroom[1] }} grade class won the silver Sneaker Award for the class with more participation.</p>
<!-- <h1>next_ride = {{ next_ride }}</h1> -->
<!-- <h1>all_rides_data = {{ rides_data }}</h1> -->
<!-- <h1>next_ride_data = {{ x.participants.g1 }}</h1> -->
</div>
</div>
</div>
</div>
{% endblock %}
-12
View File
@@ -1,12 +0,0 @@
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
+11
View File
@@ -0,0 +1,11 @@
hot chocolate,cookies
total,112
tk,0
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-???
+11
View File
@@ -0,0 +1,11 @@
hot chocolate,cookies
total,510
tk,511
k,512
1,513
2,514
3,515
4,516
5,517
most_part,Abuelito Sensei,5th
99510-Señor Vásquez Martínez-3rd,99511-Vásquez Sensei-TK,99512-Señora Martínez-5th