Compare commits

..

No commits in common. "4afa20808c6ffa61eee86fe78b7bbcd28c4c95a1" and "ada665966649f3bf75371165d0ced9404bbefc31" have entirely different histories.

1 changed files with 20 additions and 14 deletions

View File

@ -27,9 +27,7 @@ const tableData = ref([])
const konwledge = ref([])
const hasStudents = ref([])
//
const allScore = ref(0)
//
const avatarScore = ref()
const allScore = ref([])
//
const getKonwledge = () => {
const getScoreRate = []
@ -43,7 +41,7 @@ const getKonwledge = () => {
if(!ledges.includes(title.id)){
ledges.push(title.id)
// 0
konwledge.value.push({title:title.title,allPoint:allScore.value,id:title.id,point:avatarScore.value})
konwledge.value.push({title:title.title,allPoint:allScore.value,id:title.id})
}
//
if(useOverview.allData[0].hasAnswers.includes(item.studentid))
@ -53,12 +51,29 @@ const getKonwledge = () => {
//
konwledge.value.forEach(item => {
let sunRate = 0
let num = 0
if(getScoreRate.length === 0) return
getScoreRate.forEach(item2 => {
if(item.id === item2.id){
sunRate += extractedNumber(item2.rate)
num ++
}
})
const scoreRate = sunRate / num
tableData.value.push({
scoingRate:(item.point / item.allPoint * 100).toFixed(2),
scoingRate:scoreRate.toFixed(2),
...item,
point:(item.allPoint * scoreRate / 100).toFixed(2)
})
})
}
//
const extractedNumber = (score) => {
const match = score.match(/\d+/);
return match ? parseInt(match[0], 10) : null;
}
//tableList
watch(() => useOverview.tableList,() => {
@ -78,15 +93,6 @@ watch(() => useOverview.tableList,() => {
allScore.value = useOverview.allData.reduce((acc, cur) => {
return acc + Number(cur.score)
},0)
//
const studentList = useOverview.tableList.filter(item => useOverview.allData[0].hasAnswers.includes(item.studentid))
avatarScore.value = studentList.reduce((acc, cur) => {
return acc + Number(cur.getScore)
},0) / studentList.length
console.log(avatarScore.value,'useOverview.tableList');
//
getKonwledge()
})
</script>