Собрать людей
This commit is contained in:
1 parent
1d38024e88
commit
a41123acb8
5 files changed
+124
-48
No files matched your search
+46
-17
@@ -18,6 +18,7 @@ from openpyxl.styles import Font, Alignment, Side, Border, PatternFill
|
||||
from openpyxl.worksheet.formula import ArrayFormula
|
||||
from pandas.api.types import CategoricalDtype
|
||||
import urllib.request
|
||||
from django.db.models import Count
|
||||
|
||||
class GeneralVacationAPIView(APIView):
|
||||
def get(self, request):
|
||||
@@ -270,22 +271,50 @@ class DailyRoundUpAPIView(APIView):
|
||||
|
||||
class DailyloadAPIView(APIView):
|
||||
def get(self, request):
|
||||
daily = DailyRoundUp.objects.filter(todaysDate=datetime.now())
|
||||
position = BasePosition.objects.all()
|
||||
print(position, '-------------')
|
||||
result = []
|
||||
n=1
|
||||
for x in daily:
|
||||
a=model_to_dict(x)
|
||||
# print(x.user, '------------', n)
|
||||
a['user'] = model_to_dict(DictEmployee.objects.using('user_directory').get(login=x.user))
|
||||
# print(x.user, '!!!!!!!!', n)
|
||||
n=n+1
|
||||
result.append(a)
|
||||
# print(a)
|
||||
# print(x.user,'222222222222222222')
|
||||
# user = DictEmployee.objects.using('user_directory').filter(deleted=0).values('login', 'id')
|
||||
|
||||
if request.GET.__contains__('id'):
|
||||
print(request.GET.get("id"), '-------------------------------------')
|
||||
|
||||
return Response({"Обход":result})
|
||||
# return Response({"Обход":serializer_for_daily})
|
||||
|
||||
depart = DictEmployee.objects.using('user_directory').values('department')
|
||||
daily = DailyRoundUp.objects.filter(position=request.GET.get("id"),todaysDate=datetime.now()).values('user')
|
||||
result = []
|
||||
|
||||
for x in daily:
|
||||
for z in depart.filter(login=x['user']).distinct():
|
||||
if not z in result:
|
||||
result.append(z)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# for r in result:
|
||||
# r['author'] = [{"author":v.fio} for v in DictEmployee.objects.using('user_directory').filter(login=x['user'], department=r['department'])]
|
||||
# print(user,'---------------------')
|
||||
print(result, '---------------')
|
||||
|
||||
|
||||
# z['author'] = [{v.fio for v in DictEmployee.objects.using('user_directory').filter(login=x['user'], department=z['department'])}]
|
||||
# print(z, '---------------')
|
||||
# result.append(z)
|
||||
# for x in daily:
|
||||
# z['author'] = [v.fio for v in DictEmployee.objects.using('user_directory').filter(login=x['user'], department=z['department'])]
|
||||
# result.append(z)
|
||||
daily = result
|
||||
# for x in daily:
|
||||
# x['user'] = DictEmployee.objects.using('user_directory').filter(login=x['user'])
|
||||
# result.append(x)
|
||||
# print(x,'---------------------------------')
|
||||
|
||||
# print(request.GET.get("id"), '-------------------------------------')
|
||||
|
||||
|
||||
|
||||
# for x in daily:
|
||||
# x['user'] = model_to_dict(DictEmployee.objects.using('user_directory').get(login=x['user']))
|
||||
# result.append(x)
|
||||
else:
|
||||
daily = DailyRoundUp.objects.values('position__name', 'position').annotate(Count('user'))
|
||||
|
||||
return Response(daily)
|
||||
Reference in new issue
Block a user