Skip to content

Commit

Permalink
bug fix: use filter instead of get query (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruuushhh authored Aug 8, 2023
1 parent 6c75afc commit a1c8283
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions apps/workspaces/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,16 +436,9 @@ def get(self, request, *args, **kwargs):
users = workspace.user.all()
for user in users:
admin = User.objects.get(user_id=user)
name = ExpenseAttribute.objects.get(
value=admin.email,
workspace_id=kwargs['workspace_id'],
attribute_type='EMPLOYEE'
).detail['full_name']

admin_email.append({
'name': name,
'email': admin.email
})
employee = ExpenseAttribute.objects.filter(value=admin.email, workspace_id=kwargs['workspace_id'], attribute_type='EMPLOYEE').first()
if employee:
admin_email.append({'name': employee.detail['full_name'], 'email': admin.email})

return Response(
data=admin_email,
Expand Down

0 comments on commit a1c8283

Please sign in to comment.