1
This commit is contained in:
1 parent
3120090399
commit
636bd12043
5 files changed
+15
-8
No files matched your search
@@ -7,7 +7,9 @@ from rest_framework.views import APIView
|
||||
|
||||
|
||||
class FeedbackAPIView(APIView):
|
||||
|
||||
def get(self, request):
|
||||
"""Оценка сайта. Собираем информацию о критериях оценки, поставленный рейтинг и коментарий"""
|
||||
# Получаем набор всех записей из таблицы Capital
|
||||
nowrating = RatingStatus.objects.filter(usercom__user_id=self.request.user.id, usercom__time_create__contains=datetime.date.today()).order_by("crit_id")
|
||||
nowcomment = UserComment.objects.filter(user_id=self.request.user.id, time_create__contains=datetime.date.today())
|
||||
@@ -35,6 +37,11 @@ class FeedbackAPIView(APIView):
|
||||
})
|
||||
|
||||
def post(self, request):
|
||||
"""Оценка сайта.
|
||||
Параметры nowrating -
|
||||
массив объектов nowrating {id: 34, rating: 3, crit: 1, usercom: 13}
|
||||
объектnowcomment {id: 13, time_create: '2024-03-18T13:38:41.421851+03:00', comment: '', utility: true, user: 22}
|
||||
"""
|
||||
comment, created = UserComment.objects.update_or_create(id=request.data['nowcomment']['id'],user_id=self.request.user.id, defaults={'comment':request.data['nowcomment']['comment'], 'time_create':datetime.datetime.now()})
|
||||
for x in request.data['nowrating']:
|
||||
RatingStatus.objects.update_or_create(id=x['id'], defaults={'rating':x['rating'], 'crit_id':x['crit'], 'usercom_id':comment.id})
|
||||
|
||||
@@ -5,6 +5,7 @@ from rest_framework.response import Response
|
||||
from .serializers import *
|
||||
|
||||
class CaorusAPIView(ListAPIView):
|
||||
"""Карусель с произвольным набором картинок"""
|
||||
def get(self, request):
|
||||
queryset = Carousels.objects.using('add_base').all().order_by('order')
|
||||
return Response(CarouselsSerializer(queryset, many=True).data)
|
||||
@@ -6,5 +6,5 @@ urlpatterns = [
|
||||
path('generalvacation/', GeneralVacationAPIView.as_view(), name='generalvacation'),
|
||||
path('dailyroundup/', DailyRoundUpAPIView.as_view(), name='dailyroundup'),
|
||||
path('dailyload/', DailyloadAPIView.as_view(), name='dailyload'),
|
||||
path('searchuser/', SearchUserAPIView.as_view(), name='searchuser'),
|
||||
|
||||
]
|
||||
@@ -23,6 +23,7 @@ from django.db.models import Count
|
||||
|
||||
class GeneralVacationAPIView(APIView):
|
||||
def get(self, request):
|
||||
"""В работе. Необходимо для учета отпуска сотрудников"""
|
||||
general = GeneralVacation.objects.all()
|
||||
plan = PlanCalendar.objects.all()
|
||||
|
||||
@@ -39,13 +40,14 @@ class GeneralVacationAPIView(APIView):
|
||||
return Response({"Отпуск": serializer_for_basecrit.data, "План-график": serializer_for_plan.data})
|
||||
|
||||
class DailyRoundUpAPIView(APIView):
|
||||
"""Принимает файл и в параметр excel передается имя функции,"""
|
||||
|
||||
def get(self, request):
|
||||
|
||||
"""Принимает файл и в параметр excel передается имя функции, которую нужно использовать. excround - На формирование файла"""
|
||||
user = DictEmployee.objects.filter(deleted=0).values('login', 'department', 'familyname', 'name', 'parentname').order_by('id_dict_department__order_department')
|
||||
|
||||
|
||||
re = roundExcel(user)
|
||||
print( request.GET.get("excel"), '-------------------------------')
|
||||
file_path = getattr(re, request.GET.get("excel"))()
|
||||
# if request.GET.get("excel") == 'round':
|
||||
# file_path = re.excround()
|
||||
@@ -63,6 +65,7 @@ class DailyRoundUpAPIView(APIView):
|
||||
|
||||
|
||||
def post(self, request):
|
||||
"""Принимает файл и в параметр excel передается имя функции, которую нужно использовать. roundfilse - на загрузку в бд"""
|
||||
user = DictEmployee.objects.filter(deleted=0).values('login', 'id', 'fio')
|
||||
re = loadExcel(user, request.data['dailyfiles'])
|
||||
pos=''
|
||||
@@ -128,9 +131,4 @@ class DailyloadAPIView(APIView):
|
||||
daily=""
|
||||
return Response({'daily':daily, 'position':pos})
|
||||
|
||||
class SearchUserAPIView(APIView):
|
||||
def post(self, request):
|
||||
f= DictEmployee.objects.values('familyname').filter(fio__icontains=request.data['searchname'])
|
||||
|
||||
return Response('')
|
||||
|
||||
@@ -126,6 +126,7 @@ export default {
|
||||
axiosApiInstance.post(`api/feedback/feedbackdata/`, {nowrating : feedbackdata.value.nowrating, nowcomment: feedbackdata.value.nowcomment} ).then(data => {})
|
||||
feedalert.alert = true
|
||||
textFromAlert()
|
||||
console.log(feedbackdata.value.nowrating, 'feedbackdata.value.nowrating', feedbackdata.value.nowcomment , 'feedbackdata.value.nowcomment')
|
||||
|
||||
menusCloses()
|
||||
|
||||
|
||||
Reference in new issue
Block a user