adds placeholders for issue 5

This commit is contained in:
waldek 2021-05-27 21:28:04 +02:00
parent 6567adbe03
commit 263cd92a1e
2 changed files with 12 additions and 1 deletions

View File

@ -11,12 +11,12 @@ from rich.markdown import Markdown
LEVEL = "LEVEL" LEVEL = "LEVEL"
QUESTION = "QUESTION" QUESTION = "QUESTION"
ANSWER = "ANSWER" ANSWER = "ANSWER"
# EXPLANATION = ""
class Question(object): class Question(object):
""" """
class to hold the question data and methods class to hold the question data and methods
TODO: needs to json methods for the REST API
""" """
def __init__(self, data): def __init__(self, data):
@ -27,6 +27,7 @@ class Question(object):
def _clean_data(self): def _clean_data(self):
""" """
TODO needs quite bit of actual cleanup to make the parsing more robust TODO needs quite bit of actual cleanup to make the parsing more robust
TODO needs a 'private' variable for issue 5
""" """
self._level = self._data[LEVEL].strip() self._level = self._data[LEVEL].strip()
self._question = self._data[QUESTION].strip() self._question = self._data[QUESTION].strip()
@ -37,6 +38,7 @@ class Question(object):
def dump_json(self): def dump_json(self):
""" """
dumps all data to JSON for the REST API dumps all data to JSON for the REST API
TODO needs a key to include the date for issue 5
""" """
data = { data = {
"UUID": self.get_uuid(), "UUID": self.get_uuid(),
@ -52,6 +54,10 @@ class Question(object):
def get_question(self): def get_question(self):
return self._question return self._question
def get_explanation(self):
"""PLACEHOLDER for issue 5"""
pass
def _create_list_of_possibilities(self): def _create_list_of_possibilities(self):
"""creates and cleans a list of all the possible answers""" """creates and cleans a list of all the possible answers"""
possibilities = [] possibilities = []

View File

@ -72,6 +72,10 @@ class Tui(object):
md = Markdown(md) md = Markdown(md)
self._console.print(md) self._console.print(md)
def show_explanation(self, question):
"""PLACEHOLDER for issue 5"""
pass
def show_success(self, success): def show_success(self, success):
md = "# {}".format(random.choice(MSG[success])) md = "# {}".format(random.choice(MSG[success]))
md = Markdown(md) md = Markdown(md)
@ -111,6 +115,7 @@ class Application(object):
self._session.update_stats(stat) self._session.update_stats(stat)
self._interface.show_success(stat) self._interface.show_success(stat)
self._interface.show_response(question) self._interface.show_response(question)
self._interface.show_explanation(question) # will work once issue 5 is addressed
self._interface.show_stats(self._session.get_stats()) self._interface.show_stats(self._session.get_stats())
self._number -= 1 self._number -= 1
self.quit() self.quit()