diff --git a/undercover/routes.py b/undercover/routes.py index 1ff8e53..74476f7 100644 --- a/undercover/routes.py +++ b/undercover/routes.py @@ -184,11 +184,14 @@ def index_post(): if email: user = db.get_user(email) letters = db.get_user_letters(user.id) - if True: # len(letters) == 0: - db.add_letter(user.id, 'LETTER_TITLE', jsonify(data).get_data(True)) + letter_json = jsonify(data).get_data(True) + if len(letters) == 0: + db.add_letter(user.id, 'LETTER_TITLE', letter_json) else: - print("TODO: Add letter editing!") - # db.edit_letter() + # TODO: Add letter editing! + # For now, edit just the one existing letter + letter = letters[0] + db.edit_letter(letter.id, letter.title, letter_json) (resp, errors) = data.generate_pdf() if errors: