Last active
May 9, 2017 20:13
-
-
Save DustinAlandzes/c73b2d9f7576747b7d9cad1f342e4c2a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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