Skip to content

Commit

Permalink
[qa] black
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanBldy committed Sep 19, 2023
1 parent 3db5fd2 commit e5b5f5e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
12 changes: 6 additions & 6 deletions tests/user/test_route_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,7 @@ def test_get_filter_groups(self):
self.assertEqual(len(result["asset"][project_id]), 1)
self.assertEqual(len(result["shot"][project_id]), 1)
self.assertEqual(len(result["all"][project_id]), 1)
self.assertEqual(
result["asset"][project_id][0]["name"], "g1"
)
self.assertEqual(result["asset"][project_id][0]["name"], "g1")
self.assertEqual(result["shot"][project_id][0]["name"], "g2")
self.assertEqual(result["all"][project_id][0]["name"], "g3")

Expand All @@ -331,10 +329,12 @@ def test_update_filter_group(self):
search_filter_group = self.post(path, filter_group_1)
result = self.get(path)
self.assertTrue("asset" in result)
self.put("%s/%s" % (path, search_filter_group["id"]),
{"name": "updated"})
self.put(
"%s/%s" % (path, search_filter_group["id"]), {"name": "updated"}
)
result = self.get(
"data/search-filter-groups/%s" % search_filter_group["id"])
"data/search-filter-groups/%s" % search_filter_group["id"]
)
self.assertEqual(result["name"], "updated")

def test_remove_filter_group(self):
Expand Down
2 changes: 1 addition & 1 deletion zou/app/models/search_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SearchFilter(db.Model, BaseMixin, SerializerMixin):
search_filter_group_id = db.Column(
UUIDType(binary=False),
db.ForeignKey("search_filter_group.id"),
nullable=True
nullable=True,
)
person_id = db.Column(
UUIDType(binary=False), db.ForeignKey("person.id"), index=True
Expand Down
16 changes: 7 additions & 9 deletions zou/app/services/user_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,9 @@ def get_user_filter_groups(current_user_id):
result = {}

filter_groups = (
SearchFilterGroup.query
.join(Project, Project.id == SearchFilterGroup.project_id)
SearchFilterGroup.query.join(
Project, Project.id == SearchFilterGroup.project_id
)
.join(ProjectStatus, ProjectStatus.id == Project.project_status_id)
.filter(SearchFilterGroup.person_id == current_user_id)
.filter(build_open_project_filter())
Expand All @@ -906,8 +907,9 @@ def get_user_filter_groups(current_user_id):

filter_groups = (
filter_groups
+ SearchFilterGroup.query
.filter(SearchFilterGroup.person_id == current_user_id)
+ SearchFilterGroup.query.filter(
SearchFilterGroup.person_id == current_user_id
)
.filter(SearchFilterGroup.project_id == None)
.all()
)
Expand All @@ -931,11 +933,7 @@ def get_user_filter_groups(current_user_id):


def create_filter_group(
list_type,
name,
color,
project_id=None,
entity_type=None
list_type, name, color, project_id=None, entity_type=None
):
"""
Add a new search filter group to the database.
Expand Down

0 comments on commit e5b5f5e

Please sign in to comment.