Skip to content

Commit

Permalink
Bug, cannot do a record count before an iteration (#263)
Browse files Browse the repository at this point in the history
* Bug, cannot do a record count before an iteration

Create a copy of the filer to prevent other functions for using the
"count" view when making calls

* try to fix github action

---------

Co-authored-by: Shane Young <shane.y@nylas.com>
Co-authored-by: Mostafa Rashed <17770919+mrashed-dev@users.noreply.github.com>
  • Loading branch information
3 people committed Jul 20, 2023
1 parent 06a9dff commit 45ff5bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
uses: MatteoH2O1999/setup-python@v1.4.1
with:
python-version: ${{ matrix.python-version }}

Expand Down
3 changes: 2 additions & 1 deletion nylas/client/restful_model_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def count(self):
Returns:
int: The number of objects in the collection being queried
"""
self.filters["view"] = "count"
filters = self.filters.copy()
filters["view"] = "count"
response = self.api._get_resource_raw(
self.model_class, resource_id=None, **self.filters
).json()
Expand Down

0 comments on commit 45ff5bd

Please sign in to comment.