Fix bug in naming

This commit is contained in:
Logan Cusano
2025-08-02 02:21:33 -04:00
parent 2a5ca2c5a5
commit 1a5e460029

View File

@@ -91,13 +91,13 @@ async def get_random_unvoted_video(current_user: dict = Depends(is_user)):
Retrieves a random, unvoted video document from Firestore.
"""
db = get_db()
videos_stream = db.collection('videos').where('has_been_voted', '==', False).limit(1).stream()
videos_stream = db.collection('videos').where('has_been_voted', '==', False).limit(5).stream()
unvoted_videos = [doc.to_dict() for doc in videos_stream]
if not unvoted_videos:
raise HTTPException(status_code=404, detail="No more videos to vote on!")
return Video(**random_video_data)
return Video(**unvoted_videos)
@router.post("/{video_id}/vote", status_code=status.HTTP_201_CREATED)