Skip to content

Commit 23962d7

Browse files
authored
Merge pull request #17 from Deigue/main
Exclude expired activities
2 parents 3d8ea4f + 73dfe83 commit 23962d7

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

ws_api/wealthsimple_api.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,13 @@ def get_activities(
486486
# Calculate the end date for the condition
487487
end_date = (end_date if end_date else datetime.now() + timedelta(hours=23, minutes=59, seconds=59, milliseconds=999))
488488

489-
# Filter function to ignore rejected/cancelled activities
489+
# Filter function to ignore rejected/cancelled/expired activities
490490
def filter_fn(activity):
491491
act_type = (activity.get('type', '') or '').upper()
492492
status = (activity.get('status', '') or '').lower()
493-
return act_type != 'LEGACY_TRANSFER' and (not ignore_rejected or status == '' or ('rejected' not in status and 'cancelled' not in status))
493+
excluded_statuses = {'rejected', 'cancelled', 'expired'}
494+
is_excluded = any(s in status for s in excluded_statuses)
495+
return act_type != 'LEGACY_TRANSFER' and (not ignore_rejected or status == '' or not is_excluded)
494496

495497
activities = self.do_graphql_query(
496498
'FetchActivityFeedItems',

0 commit comments

Comments
 (0)