Skip to content

Commit

Permalink
refactor(backend): make ruff happy
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed Jul 5, 2024
1 parent 888b9de commit fd79cd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
22 changes: 7 additions & 15 deletions backend/timed/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,11 @@ def has_permission(self, request, view):
if not super().has_permission(request, view): # pragma: no cover
return False

if (
return (
request.user.customer_assignees.filter(is_reviewer=True).exists()
or request.user.project_assignees.filter(is_reviewer=True).exists()
or request.user.task_assignees.filter(is_reviewer=True).exists()
):
return True
return False
)

def has_object_permission(self, request, view, obj):
if not super().has_object_permission(request, view, obj): # pragma: no cover
Expand Down Expand Up @@ -220,13 +218,11 @@ def has_permission(self, request, view):
if not super().has_permission(request, view): # pragma: no cover
return False

if (
return (
request.user.customer_assignees.filter(is_manager=True).exists()
or request.user.project_assignees.filter(is_manager=True).exists()
or request.user.task_assignees.filter(is_manager=True).exists()
):
return True
return False
)

def has_object_permission(self, request, view, obj):
if not super().has_object_permission(request, view, obj): # pragma: no cover
Expand Down Expand Up @@ -280,13 +276,11 @@ def has_permission(self, request, view):
if not super().has_permission(request, view): # pragma: no cover
return False

if (
return (
request.user.customer_assignees.filter(is_resource=True).exists()
or request.user.project_assignees.filter(is_resource=True).exists()
or request.user.task_assignees.filter(is_resource=True).exists()
):
return True
return False
)

def has_object_permission(self, request, view, obj):
if not super().has_object_permission(request, view, obj): # pragma: no cover
Expand Down Expand Up @@ -339,6 +333,4 @@ def has_permission(self, request, view):
if not super().has_permission(request, view): # pragma: no cover
return False

if request.user.customer_assignees.filter(is_customer=True).exists():
return True
return False
return request.user.customer_assignees.filter(is_customer=True).exists()
2 changes: 1 addition & 1 deletion backend/timed/tracking/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ActivityFactory(DjangoModelFactory):
not_billable = False

@lazy_attribute
def from_time(self):
def from_time(self): # noqa: F811
return datetime.time(hour=randint(0, 22), minute=randint(0, 59))

@lazy_attribute
Expand Down

0 comments on commit fd79cd4

Please sign in to comment.