Обратная связь

This commit is contained in:
iriska-gri committed 2024-01-11 16:57:13 +03:00
1 parent 7bc40a1825
commit 8f701420a9
2 files changed
+33 -28

No files matched your search

@@ -7,7 +7,7 @@
{{val}}
</div>
{{total}}
{{crit}}
</div>
</div>
@@ -26,51 +26,55 @@ export default {
setup(props, context) {
const total = ref(0)
const crit = () => {
const basecrit =
props.feedback.reduce((acc, item) => {
if (!acc[item.usercom]) {
acc[item.usercom] = 0
}
acc[item.usercom] += 1
return acc
}, {}
)
return basecrit
}
const crit = ref({max: 0, id: 0, total: 0})
const average = () => {
console.log(props.feedback);
let tot = new Set()
let us = {}
let t = 0
const avgfeed =
props.feedback
.reduce((acc, item) => {
if (!acc[item.crit]) {
acc[item.crit] = []
}
acc[item.crit].push(item.rating)
tot.add(item.usercom)
if (!us[item.author.id]) {
us[item.author.id] =new Set()
}
if (item.comment.length > 0) {
us[item.author.id].add(item.usercom)
}
return acc
}, {}
)
for (let [key,val] of Object.entries(avgfeed))
{
avgfeed[key] = (val.reduce((a,b)=>{
return a+b
}, 0
)/val.length).toFixed(1)
}
for (let [key,val] of Object.entries(us))
{
t += val.size
if (crit.value.max < val.size) {
crit.value = {id:key,max:val.size}
}
}
crit.value.total = t
total.value = tot.size
return avgfeed
@@ -84,7 +88,8 @@ export default {
return {
average,
total
total,
crit
}
+2 -2
View File
@@ -90,8 +90,8 @@
</template>
<script>
import { ref, reactive, computed } from 'vue'
import {getfromserver, pagecounter, splitname} from '@/utils/universal_functions'
import { ref, computed } from 'vue'
import {pagecounter, splitname} from '@/utils/universal_functions'
import moment from 'moment'
import lineGraph from '@/components/graph/line-graph.vue'
import { axiosApiInstance } from '@/utils/axios-api'