Skip to content

Commit

Permalink
Merge 1665ff5 into 96819cd
Browse files Browse the repository at this point in the history
  • Loading branch information
Ana Margarida Silva committed Mar 9, 2022
2 parents 96819cd + 1665ff5 commit e2c8e2d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

* Graph's Dijkstra in case of no available path
* Converts the filters passed before executing the `count` operation

## [1.26.0] - 2022-02-23

Expand Down
4 changes: 4 additions & 0 deletions src/appier/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@ def find(cls, *args, **kwargs):
@classmethod
def count(cls, *args, **kwargs):
cls._clean_attrs(kwargs)

cls._find_s(kwargs)
cls._find_d(kwargs)

collection = cls._collection()
if kwargs:
if hasattr(collection, "count_documents"):
Expand Down
6 changes: 6 additions & 0 deletions src/appier/test/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ def test_count(self):
result = mock.Person.count()
self.assertEqual(result, 1)

result = mock.Person.count(**{ 'find_d': ['name:eq:Name'] })
self.assertEqual(result, 1)

result = mock.Person.count(**{ 'find_d': ['name:eq:OtherName'] })
self.assertEqual(result, 0)

def test_delete(self):
result = mock.Person.count()
self.assertEqual(result, 0)
Expand Down

0 comments on commit e2c8e2d

Please sign in to comment.