From fcfaeeb08fd64bc3d3b7d117f8448433b1e58d37 Mon Sep 17 00:00:00 2001
From: reverend <reverend@reverend2048.de>
Date: Sun, 28 Apr 2019 10:27:09 +0200
Subject: [PATCH] +import questions from json

---
 main.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/main.py b/main.py
index 6a50e62..82119e6 100644
--- a/main.py
+++ b/main.py
@@ -1,6 +1,13 @@
 from flask import Flask
 from view.questions import questions
 
+if len(Question.select()) is 0:
+    with open("questions.json", "r") as file:
+        question_list = json.load(file)
+        for text in question_list:
+            Question.create(text=text)
+
+
 app = Flask(__name__)
 app.config['SECRET_KEY'] = 'blubb'
 app.register_blueprint(questions)
-- 
GitLab