Skip to content

Commit

Permalink
Merge pull request #1283 from Bidaya0/fix/agents-list-time-filter
Browse files Browse the repository at this point in the history
fix: agent list time filter .
  • Loading branch information
Bidaya0 authored Feb 23, 2023
2 parents ceab529 + 3a98a82 commit e2d0255
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dongtai_web/views/agents_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,16 @@ def pagenation_list(self, request):
def summary(self, request):
res = {}
department = request.user.get_relative_department()
last_days = int(request.query_params.get('last_days', 0))
for type_ in StateType:
filter_condiction = generate_filter(type_)
if last_days:
filter_condiction = filter_condiction & Q(
heartbeat__dt__gte=int(time()) - 60 * 60 * 24 * last_days)
res[type_] = IastAgent.objects.filter(
generate_filter(type_),
department__in=department).count()
filter_condiction,
department__in=department,
).count()
# user__in=get_auth_users__by_id(request.user.id)).count()

return R.success(data=res)
Expand Down

0 comments on commit e2d0255

Please sign in to comment.