Skip to content

Commit

Permalink
[IMP]Improved code for helpdesk ticket functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
chandni-serpentcs authored and giarve committed Oct 11, 2024
1 parent a6d25d7 commit bb8e701
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion helpdesk_mgmt/controllers/myaccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,4 @@ def _ticket_get_order(self, order, groupby):
field_name = groupby_mapping.get(groupby, "")
if not field_name:
return order
return "%s, %s" % (field_name, order)
return f"{field_name}, {order}"

Check warning on line 262 in helpdesk_mgmt/controllers/myaccount.py

View check run for this annotation

Codecov / codecov/patch

helpdesk_mgmt/controllers/myaccount.py#L262

Added line #L262 was not covered by tests
5 changes: 3 additions & 2 deletions helpdesk_mgmt/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ def setUpClass(cls):
def _create_ticket(self, team, user=False):
return self.env["helpdesk.ticket"].create(
{
"name": "Ticket %s (%s)"
% (team.name, user.login if user else "unassigned"),
"name": "Ticket {} ({})".format(
team.name, user.login if user else "unassigned"
),
"description": "Description",
"team_id": team.id,
"user_id": user.id if user else False,
Expand Down
4 changes: 2 additions & 2 deletions helpdesk_mgmt/tests/test_helpdesk_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ def test_helpdesk_ticket_message_new(self):
try:
t = Ticket.message_new(msg_dict)
except Exception as error:
self.fail("%s: %s" % (type(error), error))
self.fail(f"{type(error)}: {error}")
self.assertEqual(t.name, title, "The ticket should have the correct title.")

title = "New title"
update_vals = {"name": title}
try:
t.message_update(msg_dict, update_vals)
except Exception as error:
self.fail("%s: %s" % (type(error), error))
self.fail(f"{type(error)}: {error}")
self.assertEqual(
t.name, title, "The ticket should have the correct (new) title."
)
Expand Down

0 comments on commit bb8e701

Please sign in to comment.