Сбор завершен

This commit is contained in:
iriska-gri committed 2024-02-13 15:44:53 +03:00
1 parent 97e0eeb701
commit 74b360e5fe
4 files changed
+23 -19

No files matched your search

@@ -29,7 +29,7 @@
lg=6 lg=6
> >
<v-rating <v-rating
v-model="message[key].rating" v-model="message[key].ratings"
:hover="typeof(key) == 'number'" :hover="typeof(key) == 'number'"
half-increments half-increments
:readonly="how==''?true:false" :readonly="how==''?true:false"
@@ -58,7 +58,7 @@ export default {
default: {} default: {}
}, },
rating: { ratings: {
type: Object, type: Object,
default: {} default: {}
}, },
@@ -74,8 +74,8 @@ export default {
// console.log(useDebugValue(getCurrentComponent().proxy.$options.name) , 'route.path'); // console.log(useDebugValue(getCurrentComponent().proxy.$options.name) , 'route.path');
const message = computed({ const message = computed({
get: () => props.rating, get: () => props.ratings,
set: (value) => emit('update:rating', value) set: (value) => emit('update:ratings', value)
}) })
return { return {
+1 -1
View File
@@ -80,7 +80,7 @@ export default {
feedbackdata.value = data.data feedbackdata.value = data.data
if (feedbackdata.value.nowrating.length == 0) { if (feedbackdata.value.nowrating.length == 0) {
for (let x of feedbackdata.value.basecrit) { for (let x of feedbackdata.value.basecrit) {
feedbackdata.value.nowrating.push({rating: x.rating, crit: x.id, id: null}) feedbackdata.value.nowrating.push({ratings: x.rating, crit: x.id, id: null})
} }
} }
if (feedbackdata.value.nowcomment === null) { if (feedbackdata.value.nowcomment === null) {
+4 -3
View File
@@ -15,9 +15,9 @@
<v-col class="w100 "> <v-col class="w100 ">
<v-row no-gutters class="h-100 gap"> <v-row no-gutters class="h-100 gap">
<v-col lg=2 class="bg-green"> <v-col lg=2 class="bg-green">
visiting- (все данные)
{{dataIndicators}} {{dataIndicators}}
<my-helper :pretext="feedback"/> <!-- <my-helper :pretext="feedback"/> -->
</v-col> </v-col>
<v-col lg=4 class="d-flex flex-column"> <v-col lg=4 class="d-flex flex-column">
<rating-page :pages_count=pages_count /> <rating-page :pages_count=pages_count />
@@ -31,7 +31,8 @@
/> />
</v-col> </v-col>
<v-col class="bg-red">4 </v-col> <v-col class="bg-red">
{{feedback}} </v-col>
</v-row> </v-row>
</v-col> </v-col>
+14 -11
View File
@@ -7,7 +7,7 @@ from rest_framework.response import Response
from django.views.generic import ListView from django.views.generic import ListView
from .serializers import * from .serializers import *
from datetime import date, datetime, timedelta from datetime import date, datetime, timedelta
from django.db.models import Sum, Q, Count from django.db.models import Sum, Q, Count, Avg, F
from userauth.models import * from userauth.models import *
from feedback.models import * from feedback.models import *
from feedback.serializers import * from feedback.serializers import *
@@ -46,25 +46,28 @@ class Counter(ListAPIView):
ppv = perioddata.count() ppv = perioddata.count()
# Обратная связь # Обратная связь
feed = RatingStatus.objects.all() feed = UserComment.objects.all()
k = feed.values_list('usercom__comment', flat=True).filter(Q(usercom__time_create__range=[request.GET.get("start"), request.GET.get("end")]) & ~Q(usercom__comment='')).distinct().count() rating = RatingStatus.objects.values('crit__name', 'crit__ico', 'crit__color', 'rating').filter(usercom__time_create__range=[request.GET.get("start"), request.GET.get("end")])
print(k, '------------------------------------------------')
# print(avgrating, '------------------------------------------------')
return Response({'result':CountSerializer(res, many=True).data, return Response({'result':CountSerializer(res, many=True).data,
# 'today':CountSerializer(nowdate, many=True).data, # 'today':CountSerializer(nowdate, many=True).data, .aggregate(res=Avg('rating'))
'feedback': { 'feedback': {
'criteria': {}, 'criteria': list(rating.values('crit__name').annotate(ratings=Avg('rating'), name=F('crit__name'), ico=F('crit__ico'), color=F('crit__color')).values('ratings', 'name', 'ico', 'color')),
'data': { 'data': {
'score': { 'score': {
'all': 0, 'all': feed.values_list('comment', flat=True).count(),
'period': 0 'period': feed.values_list('comment', flat=True).filter(time_create__range=[request.GET.get("start"), request.GET.get("end")]).count()
}, },
'comment': { 'comment': {
'all': 0, 'all': feed.values_list('comment', flat=True).filter(~Q(comment='')).count(),
'period': 0 'period': feed.values_list('comment', flat=True).filter(Q(time_create__range=[request.GET.get("start"), request.GET.get("end")]) & ~Q(comment='')).count()
}
} }
}, },
'last_comment': feed.values('time_create').filter(~Q(comment='')).earliest('time_create'),
# 'avg_score': round(avgrating['res'], 2)
},
'for_formulas': { 'for_formulas': {
'staff': DictEmployee.objects.filter(deleted=0).count(), 'staff': DictEmployee.objects.filter(deleted=0).count(),
'attendance': CountVisitor.objects.values_list('user', flat=True).filter(visitdate__range=[new_date_start, new_date_end]).distinct().count(), 'attendance': CountVisitor.objects.values_list('user', flat=True).filter(visitdate__range=[new_date_start, new_date_end]).distinct().count(),