Феедбак

This commit is contained in:
iriska-gri committed 2024-03-05 14:38:27 +03:00
1 parent e3ab5c42c0
commit f1dd6bd408
10 files changed
+66 -114

No files matched your search

+1 -1
View File
@@ -36,7 +36,7 @@ class FeedbackAPIView(APIView):
def post(self, request): def post(self, request):
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()}) 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()})
print(request.data['nowrating'], '--------------------------------------')
for x in request.data['nowrating']: 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}) RatingStatus.objects.update_or_create(id=x['id'], defaults={'rating':x['rating'], 'crit_id':x['crit'], 'usercom_id':comment.id})
return Response({}) return Response({})
@@ -13,7 +13,7 @@
<list-user :author= "top.author" :from_which="'top_comment'"/> <list-user :author= "top.author" :from_which="'top_comment'"/>
</v-col> </v-col>
<v-col class="align-self-center pl-0"> <v-col class="align-self-center pl-0">
<!-- <my-helper :pretext="top.comment"/> --> <my-helper :pretext="top.comment"/>
<v-table density="compact" class="pa-0"> <v-table density="compact" class="pa-0">
<thead> <thead>
<tr > <tr >
@@ -30,10 +30,11 @@
</span> </span>
</template> </template>
<v-card max-width='400' density="compact" class="bg-transparent"> <v-card max-width='400' density="compact" class="bg-transparent">
<v-card-title>Оставлено комментариев</v-card-title> <v-card-text class="pb-0">Оставлено комментариев</v-card-text>
<v-card-subtitle>Последний комментарий оставлен {{formaComaTime(top.comment[0].time_create)}}</v-card-subtitle> <v-card-subtitle>Последний комментарий оставлен {{formaComaTime(top.comment[0].time_create)}}</v-card-subtitle>
<v-card-text>{{top.comment[0].comment}}</v-card-text> <v-card-title>{{top.comment[0].comment}}</v-card-title>
</v-card> </v-card>
</v-tooltip> </v-tooltip>
</th> </th>
@@ -92,9 +93,8 @@ export default {
}, },
setup(props) { setup() {
console.log(props.top, 'gggggggggggggg')
return { return {
formaComaTime formaComaTime
} }
@@ -6,6 +6,7 @@
:ico="'mdi-comment-multiple-outline'" :ico="'mdi-comment-multiple-outline'"
> >
<template v-slot:filling> <template v-slot:filling>
<my-helper :pretext="feedback"/>
<v-row no-gutters class="flex-column gap"> <v-row no-gutters class="flex-column gap">
<v-col lg=1 class="w100"> <v-col lg=1 class="w100">
<v-card variant="flat" class="text-h6 font-weight-regular"> <v-card variant="flat" class="text-h6 font-weight-regular">
@@ -23,7 +24,7 @@
v-for=" x in feedback.data" v-for=" x in feedback.data"
:key=x :key=x
> >
<!-- <my-helper :pretext="x"/> -->
<card-feedback :data="x"/> <card-feedback :data="x"/>
</v-col> </v-col>
<v-col class="d-flex flex-column"> <v-col class="d-flex flex-column">
@@ -91,14 +92,15 @@ export default {
if (Object.keys(ob).length > 0){ if (Object.keys(ob).length > 0){
let top = Object.keys(ob).reduce((a,b) => ob[a] > ob[b] ? a: b) let top = Object.keys(ob).reduce((a,b) => ob[a] > ob[b] ? a: b)
let puser = props.feedback.feed.filter(e=> e.author.id == top) let puser = props.feedback.feed.filter(e=> e.author.id == top)
tuser=Object.assign({},puser[puser.length-1]) tuser=Object.assign({},puser[puser.length-1])
tuser.fio=splitname(tuser.author) tuser.fio=splitname(tuser.author)
tuser.score = puser.length tuser.score = puser.length
tuser.comment = puser.filter(e=>e.comment.length>0).sort((a,b)=> {return a.id-b.id}) console.log(puser, ' top');
tuser.comment = puser.filter(e=>e.comment.length>0).sort((a,b)=> {return b.id-a.id})
} }
@@ -108,42 +110,7 @@ export default {
} }
}) })
const top_comment = () => {
let topUser = props.feedback.feed.reduce((acc, item)=> {
if (!acc[item.author.id]) {
acc[item.author.id] ={author: {id: 0, login: "", post: "", fio: ""}, score: 0, comment: {textarr: [], data: '', text: ''}}
}
acc[item.author.id].author.id = item.author.id
acc[item.author.id].author.login = item.author.login
acc[item.author.id].author.post = item.author.post
acc[item.author.id].author.fio = splitname(item.author)
acc[item.author.id].score +=1
if (item.comment != "") {
acc[item.author.id].comment.textarr.push(item.comment)
acc[item.author.id].comment.data = formaComaTime(item.time_create)
acc[item.author.id].comment.text = item.comment
}
return acc
}, {})
if(Object.keys(topUser).length>0){
const sorted = topUser
.sort((a,b) => (b.comment.textarr.length - a.comment.textarr.length))
dataTopUser.value = sorted[0][1]
}else{
// console.log(props.feedback.feed, sorted, 'dataTopUser.valuedataTopUser.value');
dataTopUser.value =[]
}
}
// top_comment()
return { return {
formaComaTime, formaComaTime,
+10 -3
View File
@@ -37,6 +37,8 @@
hide-header hide-header
@update:modelValue="dateStart" @update:modelValue="dateStart"
border border
:max="formatDash(new Date())"
:min="formatDash(appStore.countvisitor.visitdate)"
/> />
</v-locale-provider> </v-locale-provider>
@@ -46,7 +48,8 @@
<script> <script>
import { ref } from 'vue' import { ref } from 'vue'
import {formatComa} from '@/utils/universal_functions' import {formatComa, formatDash} from '@/utils/universal_functions'
import { useAppStore } from '@/store/app'
export default { export default {
props: { props: {
@@ -59,7 +62,9 @@ export default {
setup(props, {emit}) { setup(props, {emit}) {
const appStore = useAppStore()
const maxdate = formatDash(new Date())
console.log(maxdate, 'ssssssssssssssssssssss');
const menudate = ref(false) const menudate = ref(false)
const selectedDate = ref(null) const selectedDate = ref(null)
@@ -74,7 +79,9 @@ export default {
menudate, menudate,
selectedDate, selectedDate,
dateStart, dateStart,
formatComa formatComa,
formatDash,
appStore,
} }
} }
@@ -18,8 +18,9 @@
{{x.name}} {{x.name}}
</v-col> </v-col>
<v-col lg=6> <v-col lg=6>
<v-rating <v-rating
v-model="message[key].ratings" v-model="message[key].rating"
:hover="typeof(key) == 'number'" :hover="typeof(key) == 'number'"
half-increments half-increments
color="yellow" color="yellow"
@@ -35,23 +36,38 @@
:title="'Средняя оценка'" :title="'Средняя оценка'"
> >
<template v-slot:filling_feedback> <template v-slot:filling_feedback>
<v-row <v-row
v-for="(x, key) in criteria"
:key = key class="align-center flex-column scoreheight gap mt-n2"
class="align-center mt-n2"
no-gutters no-gutters
> >
<v-col lg=12 class="text-h6 font-weight-regular">
<div class="flex-columnd-flex gap pa-0"
v-for="(x, key) in criteria"
:key = key
>
<v-col lg=1 class="text-h6 font-weight-regular w100 pa-0"
>
<v-icon <v-icon
size="small" size="small"
:color="x.color" :color="x.color"
:icon="x.ico" :icon="x.ico"
/> />
{{x.name}} {{x.name}}
</v-col> </v-col>
<v-col lg=12> <v-col lg=2 class=" w100 pa-2 pt-1">
<v-rating <v-rating
v-model="message[key].ratings" v-model="message[key].rating"
:hover="typeof(key) == 'number'" :hover="typeof(key) == 'number'"
@@ -61,7 +77,9 @@
:density="'comfortable'" :density="'comfortable'"
/> />
</v-col> </v-col>
</div>
</v-row> </v-row>
</template> </template>
</pattern-card-feed> </pattern-card-feed>
@@ -96,6 +114,7 @@ export default {
}, },
setup(props, { emit }) { setup(props, { emit }) {
const message = computed({ const message = computed({
get: () => props.ratings, get: () => props.ratings,
@@ -112,5 +131,7 @@ export default {
</script> </script>
<style> <style>
.scoreheight {
min-height: 240px;
}
</style> </style>
@@ -40,7 +40,7 @@
v-if="from_which=='top_comment'" v-if="from_which=='top_comment'"
@click="open=true" @click="open=true"
cover cover
class="cursor-pointer"
:src="checkremote(`${spravURL}${author.login}.jpg`)" :src="checkremote(`${spravURL}${author.login}.jpg`)"
/> />
<!-- </v-list-item> --> <!-- </v-list-item> -->
+1
View File
@@ -118,6 +118,7 @@ export default {
} }
function feedSend() { function feedSend() {
console.log(feedbackdata.value.nowrating, 'feedbackdata.value.nowrating----------------------');
axiosApiInstance.post(`api/feedback/feedbackdata/`, {nowrating : feedbackdata.value.nowrating, nowcomment: feedbackdata.value.nowcomment} ).then(data => {}) axiosApiInstance.post(`api/feedback/feedbackdata/`, {nowrating : feedbackdata.value.nowrating, nowcomment: feedbackdata.value.nowcomment} ).then(data => {})
menusCloses() menusCloses()
} }
+5 -52
View File
@@ -46,7 +46,7 @@
</v-row> </v-row>
</v-col> </v-col>
<v-col lg=2 class="bg-red"> <v-col lg=2 >
<feedmodul <feedmodul
:feedback="alldata.feedback" :feedback="alldata.feedback"
/> />
@@ -54,61 +54,14 @@
</v-row> </v-row>
</v-col> </v-col>
</v-row> </v-row>
<!-- <v-row v-if="Object.keys(feedback).length==0">
<v-col class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light">
<v-progress-circular
:size="150"
:width="7"
color="cyan-darken-3"
indeterminate
></v-progress-circular>
</v-col>
</v-row> -->
<!-- v-else -->
<!-- <v-row no-gutters class="flex-column gap ma-1" >
<v-col lg=4 class="w100">
<v-row no-gutters class="h-100 gap">
<v-col lg=2>
</v-col>
<v-col lg=8>
</v-col>
</v-row>
</v-col>
<v-col class="w100 ">
<v-row no-gutters class="h-100 gap">
<v-col class="flex-column d-flex">
<v-row no-gutters class="flex-column gap" >
<v-col v-for="x in cardtotal" :key=x>
<card-total :indicator=x />
</v-col>
</v-row>
</v-col>
<v-col lg=4 class="d-flex flex-column">
</v-col>
<v-col lg=4 class="d-flex flex-column ">
</v-col>
<v-col class="d-flex flex-column">
</v-col>
</v-row>
</v-col>
</v-row> -->
</template> </template>
<script> <script>
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
import {pagecounter, splitname, formatComa, formatDash, checking_for_entry} from '@/utils/universal_functions' import {pagecounter, splitname, formatComa, formatDash, formaComaTime, checking_for_entry} from '@/utils/universal_functions'
import { axiosApiInstance } from '@/utils/axios-api' import { axiosApiInstance } from '@/utils/axios-api'
import { usePortalFilterStore } from '@/store/AboutPortalFilter' import { usePortalFilterStore } from '@/store/AboutPortalFilter'
@@ -175,9 +128,9 @@ setup(){
const visition = () => { const visition = () => {
axiosApiInstance.get(`api/watcher/testwatcher/?start=${formatDash(filterStore.date_period.startdate)}&end=${formatDash(filterStore.date_period.enddate)}`).then(result => { axiosApiInstance.get(`api/watcher/testwatcher/?start=${formatDash(filterStore.date_period.startdate)}&end=${formatDash(filterStore.date_period.enddate)}`).then(result => {
console.log(result.data, 'result.data');
alldata.value = preparedata(result.data) alldata.value = preparedata(result.data)
// console.log(result.data, 'result.data'); //
totalfn() totalfn()
+1 -1
View File
@@ -25,7 +25,7 @@
<v-btn block class="text-caption" @click="filter='month'">Месяц</v-btn> <v-btn block class="text-caption" @click="filter='month'">Месяц</v-btn>
<v-btn block class="text-caption" @click="filter='day'">День</v-btn> <v-btn block class="text-caption" @click="filter='day'">День</v-btn>
<!-- ------------------------------------------------------------------------- --> <!-- ------------------------------------------------------------------------- -->
<my-helper :pretext="feedback"/>
{{filter}} {{filter}}
</v-col> </v-col>
</v-row> </v-row>
+5 -2
View File
@@ -68,6 +68,7 @@ class TestwatcherAPIView(ListAPIView):
data_start = datetime.strptime(request.GET.get("start"), "%Y-%m-%d").date() data_start = datetime.strptime(request.GET.get("start"), "%Y-%m-%d").date()
data_end = datetime.strptime(request.GET.get("end"), "%Y-%m-%d").date() data_end = datetime.strptime(request.GET.get("end"), "%Y-%m-%d").date()
data_rating = data_end + timedelta(days=1)
beetween = data_end - (data_start - timedelta(days=1)) beetween = data_end - (data_start - timedelta(days=1))
print(beetween, 'beetween') print(beetween, 'beetween')
# #
@@ -77,8 +78,10 @@ class TestwatcherAPIView(ListAPIView):
# print( DictEmployee.objects.filter(Q(deleteddate__isnull= True) | Q(deleteddate__gte = request.GET.get("end"))).count()) # print( DictEmployee.objects.filter(Q(deleteddate__isnull= True) | Q(deleteddate__gte = request.GET.get("end"))).count())
# Обратная связь # Обратная связь
feed = UserComment.objects.all() feed = UserComment.objects.all()
rating = RatingStatus.objects.values('crit__name', 'crit__ico', 'crit__color', 'rating').filter(usercom__time_create__range=[request.GET.get("start"), request.GET.get("end")]) rating = RatingStatus.objects.values('crit__name', 'crit__ico', 'crit__color', 'rating').filter(usercom__time_create__range=[request.GET.get("start"), data_rating])
d = feed.filter(time_create__range=[request.GET.get("start"), request.GET.get("end")])
print(feed, ' -------------------------rating')
d = feed.filter(time_create__range=[request.GET.get("start"), data_rating])
return Response({ return Response({
'beforperiod': res, 'beforperiod': res,
'period': PagesSerializer(per, many= True).data, 'period': PagesSerializer(per, many= True).data,