Fix: can't save in create exam

This commit is contained in:
Bertrand Benjamin 2021-05-10 12:21:42 +02:00
parent 1ffdd8676b
commit 29f67cfa0c

View File

@ -3,7 +3,8 @@
from datetime import datetime
from pathlib import Path
from prompt_toolkit import HTML
# from prompt_toolkit import HTML
from ..config import NO_ST_COLUMNS
import pandas as pd
import yaml
@ -61,7 +62,9 @@ class Exam:
try:
self._exercises[name]
except KeyError:
self._exercises[name] = format_question(questions)
self._exercises[name] = [
format_question(question) for question in questions
]
else:
raise KeyError("The exercise already exsists. Use modify_exercise")
@ -153,6 +156,7 @@ class Exam:
def write_csv(self):
rows = self.to_row()
print(rows)
base_df = pd.DataFrame.from_dict(rows)[NO_ST_COLUMNS.keys()]
base_df.rename(columns=NO_ST_COLUMNS, inplace=True)