Обратная связь
This commit is contained in:
1 parent
7bc40a1825
commit
8f701420a9
2 files changed
+33
-28
No files matched your search
@@ -7,7 +7,7 @@
|
|||||||
{{val}}
|
{{val}}
|
||||||
</div>
|
</div>
|
||||||
{{total}}
|
{{total}}
|
||||||
|
{{crit}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -26,51 +26,55 @@ export default {
|
|||||||
|
|
||||||
setup(props, context) {
|
setup(props, context) {
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
|
const crit = ref({max: 0, id: 0, total: 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 average = () => {
|
const average = () => {
|
||||||
console.log(props.feedback);
|
|
||||||
let tot = new Set()
|
let tot = new Set()
|
||||||
|
let us = {}
|
||||||
|
let t = 0
|
||||||
const avgfeed =
|
const avgfeed =
|
||||||
|
|
||||||
props.feedback
|
props.feedback
|
||||||
.reduce((acc, item) => {
|
.reduce((acc, item) => {
|
||||||
if (!acc[item.crit]) {
|
if (!acc[item.crit]) {
|
||||||
acc[item.crit] = []
|
acc[item.crit] = []
|
||||||
}
|
}
|
||||||
acc[item.crit].push(item.rating)
|
acc[item.crit].push(item.rating)
|
||||||
|
|
||||||
tot.add(item.usercom)
|
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
|
return acc
|
||||||
}, {}
|
}, {}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
for (let [key,val] of Object.entries(avgfeed))
|
for (let [key,val] of Object.entries(avgfeed))
|
||||||
{
|
{
|
||||||
avgfeed[key] = (val.reduce((a,b)=>{
|
avgfeed[key] = (val.reduce((a,b)=>{
|
||||||
return a+b
|
return a+b
|
||||||
}, 0
|
}, 0
|
||||||
)/val.length).toFixed(1)
|
)/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
|
total.value = tot.size
|
||||||
return avgfeed
|
return avgfeed
|
||||||
|
|
||||||
@@ -84,7 +88,8 @@ export default {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
average,
|
average,
|
||||||
total
|
total,
|
||||||
|
crit
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,8 +90,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref, reactive, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import {getfromserver, pagecounter, splitname} from '@/utils/universal_functions'
|
import {pagecounter, splitname} from '@/utils/universal_functions'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import lineGraph from '@/components/graph/line-graph.vue'
|
import lineGraph from '@/components/graph/line-graph.vue'
|
||||||
import { axiosApiInstance } from '@/utils/axios-api'
|
import { axiosApiInstance } from '@/utils/axios-api'
|
||||||
|
|||||||
Reference in new issue
Block a user