Skip to content

Instantly share code, notes, and snippets.

@DustinAlandzes
Last active May 9, 2017 20:13
Show Gist options
  • Save DustinAlandzes/c73b2d9f7576747b7d9cad1f342e4c2a to your computer and use it in GitHub Desktop.
Save DustinAlandzes/c73b2d9f7576747b7d9cad1f342e4c2a to your computer and use it in GitHub Desktop.
from app import app, db
from app.models import Queue
questions = Queue.query.get(15).images.all()
answers = Queue.query.get(16).images.all()
print("# of questions: {}".format(len(questions)))
print("# of answers: {}".format(len(answers)))
trivia = Queue("trivia")
db.session.add(trivia)
db.session.commit()
both = []
for image in questions:
both.append(image)
for image in answers:
both.append(image)
count = 0
for image in both:
image.queue_id = trivia.id
image.position = count
db.session.add(image)
count += 1
db.session.commit()
print("new trivia queue created")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment