Skip to content

Commit

Permalink
added not renderer for character remove/add
Browse files Browse the repository at this point in the history
  • Loading branch information
Henjuro committed Nov 24, 2020
1 parent 44a1449 commit d6993f2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion waitlist/utility/account/notes/note_renderer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from waitlist.storage.database import AccountNote
from waitlist.storage.database import AccountNote, Character
from waitlist.utility.constants import account_notes
from waitlist.utility.eve_id_utils import get_character_by_id
import json
Expand Down Expand Up @@ -67,6 +67,12 @@ def render_note_text(note: AccountNote) -> str:
elif note.type == account_notes.TYPE_ACCOUNT_NAME_CHANGED:
return (f'Changed name from "{note.jsonPayload["old_name"]}" '
f'to "{note.jsonPayload["new_name"]}"')
elif note.type == account_notes.TYPE_ACCOUNT_CHARACTER_LINK_ADDED:
character: Character = get_character_by_id(note.jsonPayload['character_id'])
return (f'{note.by.username} added Character {character.get_eve_name()} to Account {note.account.username}')
elif note.type == account_notes.TYPE_ACCOUNT_CHARACTER_LINK_REMOVED:
character: Character = get_character_by_id(note.jsonPayload['character_id'])
return (f'{note.by.username} removed Character {character.get_eve_name()} from Account {note.account.username}')
else:
logger.error('Unhandler AccountNote type: %s', note.type)
return f'Unhandled AccountNote type: {note.type}'

0 comments on commit d6993f2

Please sign in to comment.