Merge branch 'main' into production
Some checks are pending
Deploy Elmeg / deploy (push) Waiting to run
Some checks are pending
Deploy Elmeg / deploy (push) Waiting to run
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
This commit is contained in:
commit
1d0464c219
3 changed files with 71 additions and 4 deletions
|
|
@ -38,3 +38,9 @@ app.include_router(stats.router)
|
|||
@app.get("/")
|
||||
def read_root():
|
||||
return {"Hello": "World"}
|
||||
|
||||
@app.get("/healthz")
|
||||
def health_check():
|
||||
"""Health check endpoint for monitoring and load balancers"""
|
||||
return {"status": "healthy"}
|
||||
|
||||
|
|
|
|||
64
backend/seed_ratings.py
Normal file
64
backend/seed_ratings.py
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
"""
|
||||
Seed script to create demo ratings for shows and performances.
|
||||
Run with: python seed_ratings.py
|
||||
"""
|
||||
from sqlmodel import Session, create_engine, select
|
||||
from database import DATABASE_URL
|
||||
from models import Rating, Show, Performance, User
|
||||
import random
|
||||
|
||||
def seed_ratings():
|
||||
engine = create_engine(DATABASE_URL)
|
||||
|
||||
with Session(engine) as session:
|
||||
# Get first user (or admin) to attribute ratings to
|
||||
user = session.exec(select(User).limit(1)).first()
|
||||
if not user:
|
||||
print("No users found. Please create a user first.")
|
||||
return
|
||||
|
||||
# Get some shows
|
||||
shows = session.exec(select(Show).limit(20)).all()
|
||||
# Get some performances
|
||||
performances = session.exec(select(Performance).limit(50)).all()
|
||||
|
||||
created_count = 0
|
||||
|
||||
# Seed show ratings (7-10 range for positive feel)
|
||||
for show in shows:
|
||||
# Check if rating already exists
|
||||
existing = session.exec(
|
||||
select(Rating).where(Rating.show_id == show.id, Rating.user_id == user.id)
|
||||
).first()
|
||||
if existing:
|
||||
continue
|
||||
|
||||
rating = Rating(
|
||||
user_id=user.id,
|
||||
show_id=show.id,
|
||||
score=random.randint(7, 10)
|
||||
)
|
||||
session.add(rating)
|
||||
created_count += 1
|
||||
|
||||
# Seed performance ratings
|
||||
for perf in performances:
|
||||
existing = session.exec(
|
||||
select(Rating).where(Rating.performance_id == perf.id, Rating.user_id == user.id)
|
||||
).first()
|
||||
if existing:
|
||||
continue
|
||||
|
||||
rating = Rating(
|
||||
user_id=user.id,
|
||||
performance_id=perf.id,
|
||||
score=random.randint(6, 10)
|
||||
)
|
||||
session.add(rating)
|
||||
created_count += 1
|
||||
|
||||
session.commit()
|
||||
print(f"Created {created_count} demo ratings!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
seed_ratings()
|
||||
|
|
@ -48,10 +48,7 @@ export function Navbar() {
|
|||
<Link href="/tours">
|
||||
<DropdownMenuItem>Tours</DropdownMenuItem>
|
||||
</Link>
|
||||
<DropdownMenuSeparator />
|
||||
<Link href="/leaderboards">
|
||||
<DropdownMenuItem>Leaderboards</DropdownMenuItem>
|
||||
</Link>
|
||||
{/* Leaderboards hidden until community activity grows */}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue