Skip to content

Commit

Permalink
added to/cc to ticket details
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Philion committed Mar 10, 2024
1 parent 19a29f9 commit 398a1f7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
11 changes: 7 additions & 4 deletions formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@ def format_ticket_details(self, ticket:Ticket) -> str:
details = f"# {ticket.tracker} {link}\n"
details += f"## {ticket.subject}\n"
details += f"Added by {ticket.author} {created_age} ago. Updated {updated_age} ago.\n"
details += f"**Status**: {status}\n"
details += f"**Priority**: {priority}\n"
details += f"**Assignee**: {assigned}\n"
details += f"**Category**: {ticket.category}\n"
details += f"**Status:** {status}\n"
details += f"**Priority:** {priority}\n"
details += f"**Assignee:** {assigned}\n"
details += f"**Category:** {ticket.category}\n"
if ticket.to or ticket.cc:
details += f"**To:** {', '.join(ticket.to)} **Cc:** {', '.join(ticket.cc)}\n"

details += f"### Description\n{ticket.description}"
return details

Expand Down
14 changes: 10 additions & 4 deletions tickets.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,22 @@ def json_str(self):
def to(self) -> list[str]:
val = self.get_custom_field(TO_CC_FIELD_NAME)
if val:
# string contains to,to//cc,cc
to_str, _ = val.split('//')
if '//' in val:
# string contains to,to//cc,cc
to_str, _ = val.split('//')
else:
to_str = val
return [to.strip() for to in to_str.split(',')]

@property
def cc(self) -> list[str]:
val = self.get_custom_field(TO_CC_FIELD_NAME)
if val:
# string contains to,to//cc,cc
_, cc_str = val.split('//')
if '//' in val:
# string contains to,to//cc,cc
_, cc_str = val.split('//')
else:
cc_str = val
return [to.strip() for to in cc_str.split(',')]

def __str__(self):
Expand Down

0 comments on commit 398a1f7

Please sign in to comment.