Fix default letter names.

This commit is contained in:
Sage Vaillancourt 2022-09-29 13:22:36 -04:00
parent 6bb6821d39
commit 05ab019901
1 changed files with 2 additions and 2 deletions

View File

@ -140,7 +140,7 @@ def add_letter() -> Response:
user = db.get_user(email_address) user = db.get_user(email_address)
existing_letter_count = len(db.get_user_letters(user.id)) existing_letter_count = len(db.get_user_letters(user.id))
new_letter_name = f'Letter{existing_letter_count + 2}' new_letter_name = f'Letter {existing_letter_count + 1}'
default_form_json = jsonify(CLForm().to_cl_data()).get_data(True) default_form_json = jsonify(CLForm().to_cl_data()).get_data(True)
db.add_letter(user.id, new_letter_name, default_form_json) db.add_letter(user.id, new_letter_name, default_form_json)
return redirect(f'/?letter_name={new_letter_name}') return redirect(f'/?letter_name={new_letter_name}')
@ -289,7 +289,7 @@ def generate_pdf() -> Response:
letters = db.get_user_letters(user.id) letters = db.get_user_letters(user.id)
letter_json = jsonify(data).get_data(True) letter_json = jsonify(data).get_data(True)
if len(letters) == 0: if len(letters) == 0:
db.add_letter(user.id, 'My Cover Letter', letter_json) db.add_letter(user.id, 'Letter1', letter_json)
else: else:
letter = letters[data.selectedLetter] letter = letters[data.selectedLetter]
# TODO: Support title editing # TODO: Support title editing