Skip to content

Commit

Permalink
Merge pull request #44 from Hackathon2020/feat-korrekturschreibfehler
Browse files Browse the repository at this point in the history
Feat korrekturschreibfehler
  • Loading branch information
cwecht committed Mar 22, 2020
2 parents 8cf2eb0 + db84be7 commit af1d3e9
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 9 deletions.
20 changes: 20 additions & 0 deletions project/flaskr/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,43 @@


def create_app():
"""
Create the Flask app for Grenz-er-fahrung: An easy to use Web Service to cross borders fast and efficient.
Returns: Flask App
"""
app = Flask(__name__, template_folder=template_folder, static_folder=static_folder)
Bootstrap(app)

#@app.route('/', methods=["GET", "POST"])
#@app.route('/index')
@app.route('/information')
def index():
"""
Page for the information -> General Information about the Crossing
Returns: Template for Information
"""
return render_template("app/informations.html")

@app.route("/")
@app.route("/language")
def language_selection():
"""
Page for language Selection -> Language for the questionnaire
Returns: HTML Page
"""
return render_template("app/language.html")
pass

@app.route("/crossing")
def border_selection():
"""
Page for which border to cross
Returns: HTML Page
"""
return render_template("app/crossing.html")

@app.route('/answer')
Expand Down
9 changes: 9 additions & 0 deletions project/flaskr/routes/questionaire.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@


def get_questionaire_blueprint(questions, json_schema):
"""
Flask routing for the questionnaire
Args:
questions: List[localized_question, localized_question, ...]
json_schema: The json schema for the questionnaire
Returns: the blueprint for routing of the questionaire
"""
questionnair = Blueprint('questionnair', __name__, template_folder=template_folder, static_folder=static_folder)
@questionnair.route('/', methods=["GET", "POST"])
@questionnair.route('/index')
Expand Down
17 changes: 9 additions & 8 deletions project/questionaire.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

class Questionaire:
""" holds all relevant data of a questionaire
""" holds all relevant data of a questionnaire
"""
global_questionaire_id = ""
language_map = {}
questions = []

""" initialization
:paran str global_id -- the globally unique identifier of this questionaire. This is needed to connect questionaires with anwsers.
:param dict language_map -- (dict of str: (str: str)) -- containes the text-snippets used in this questionaire in every supported language. \
:paran str global_id -- the globally unique identifier of this questionnaire. This is needed to connect questionnaires with anwsers.
:param dict language_map -- (dict of str: (str: str)) -- contains the text-snippets used in this questionaire in every supported language. \
The mapping is "language" -> "id" -> "text
:param list questions -- (list of Question)the actual questions in the questionaire
:param list questions -- (list of Question)the actual questions in the questionnaire
"""
def __init__(self, global_id, language_map, questions):
assert type(global_id) is str
Expand All @@ -22,7 +22,7 @@ def __init__(self, global_id, language_map, questions):
self.questions = questions

"""
Creteas a localized list of the questions for the given language
Creates a localized list of the questions for the given language
:param str language -- the language to localize to
:rtype list of LocalizedQuestion
Expand All @@ -42,9 +42,10 @@ class Question:

""" initialization
:param str question_id -- the identifier of the question. This is needed to idenitify the corresponing question test stored in the Questionaire'S language_map and associate questions with anwsers
:param str anwser_type -- which kind of anwser is expected (string, date, PLZ,...)
:param list options -- optional (array of strings) specifies all possible anwsers
:param str question_id -- the identifier of the question. This is needed to identify the corresponding
question test stored in the Questionnaire'S language_map and associate questions with answers
:param str answer_type -- which kind of answer is expected (string, date, PLZ,...)
:param list options -- optional (array of strings) specifies all possible answers
"""
def __init__(self, question_id, anwser_type, options=[]):
assert type(question_id ) is str
Expand Down
2 changes: 1 addition & 1 deletion project/questions_from_json.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
import jsonschema
import pathlib
import project.questionaire as questionaire


Expand All @@ -9,6 +8,7 @@ def read(filename, context):
Reads questionaire from file
:param filename -- path to file containing questionaire
:param context -- filepath to the schema files
:rtype questionaire.Questionaire
:return a questionaire
"""
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ six==1.14.0
visitor==0.1.3
Werkzeug==1.0.0
WTForms==2.2.1
PyQt5==5.12.2
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#"chainer",
#"numpy",
#"pandas", # for csv dataset and eval pipeline
"flask-bootstrap"
"flask-wtf"
"flask",
"jsonschema"
]
Expand Down

0 comments on commit af1d3e9

Please sign in to comment.