Skip to content

Commit 1d70bfe

Browse files
committed
chore: regrouped all helper functions calls together
1 parent a342f36 commit 1d70bfe

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "ws-api"
7-
version = "0.29.4"
7+
version = "0.30.0"
88
description = "Access your Wealthsimple account using their (GraphQL) API."
99
readme = "README.md"
1010
license = {file = "LICENSE"}

ws_api/formatters.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,10 @@ def format_activity_description(act: dict, api_context) -> None:
212212
"""
213213
act["description"] = f"{act['type']}: {act['subType']}"
214214

215-
if act["type"] == "INTERNAL_TRANSFER" or act["type"] == "ASSET_MOVEMENT":
215+
if _format_corporate_action_subdivision(act, api_context) or _format_institutional_transfer(act, api_context) or _format_credit_card_description(act):
216+
pass # Handled by helper function
217+
218+
elif act["type"] == "INTERNAL_TRANSFER" or act["type"] == "ASSET_MOVEMENT":
216219
accounts = api_context.get_accounts(False)
217220
matching = [acc for acc in accounts if acc["id"] == act["opposingAccountId"]]
218221
target_account = matching.pop() if matching else None
@@ -245,9 +248,6 @@ def format_activity_description(act: dict, api_context) -> None:
245248
f"{security} @ {float(act['amount']) / float(act['assetQuantity'])}"
246249
)
247250

248-
elif _format_corporate_action_subdivision(act, api_context):
249-
pass # Handled by helper function
250-
251251
elif act["type"] in ["DEPOSIT", "WITHDRAWAL"] and act["subType"] in [
252252
"E_TRANSFER",
253253
"E_TRANSFER_FUNDING",
@@ -281,8 +281,6 @@ def format_activity_description(act: dict, api_context) -> None:
281281
elif act["type"] == "REFUND" and act["subType"] == "TRANSFER_FEE_REFUND":
282282
act["description"] = "Reimbursement: account transfer fee"
283283

284-
elif _format_institutional_transfer(act, api_context):
285-
pass # Handled by helper function
286284
elif act["type"] == "INTEREST":
287285
if act["subType"] == "FPL_INTEREST":
288286
act["description"] = "Stock Lending Earnings"
@@ -340,9 +338,6 @@ def format_activity_description(act: dict, api_context) -> None:
340338
type_ = act["type"].capitalize()
341339
act["description"] = f"{type_}"
342340

343-
elif _format_credit_card_description(act):
344-
pass # Handled by helper function
345-
346341
elif act["type"] == "REIMBURSEMENT" and act["subType"] == "CASHBACK":
347342
program = (
348343
"- Visa Infinite"

0 commit comments

Comments
 (0)