|
@@ -28,7 +28,13 @@
|
|
|
</div>
|
|
</div>
|
|
|
<!--题目table-->
|
|
<!--题目table-->
|
|
|
<div class="question-list">
|
|
<div class="question-list">
|
|
|
- <b-table :data="data" paginated per-page="5" detailed detail-key="id">
|
|
|
|
|
|
|
+ <b-table
|
|
|
|
|
+ :data="data"
|
|
|
|
|
+ paginated
|
|
|
|
|
+ per-page="50"
|
|
|
|
|
+ detailed
|
|
|
|
|
+ detail-key="id"
|
|
|
|
|
+ >
|
|
|
<template slot-scope="props">
|
|
<template slot-scope="props">
|
|
|
<b-table-column field="id" label="ID" width="40" numeric sortable>
|
|
<b-table-column field="id" label="ID" width="40" numeric sortable>
|
|
|
{{ props.row.id }}
|
|
{{ props.row.id }}
|
|
@@ -53,8 +59,8 @@
|
|
|
sortable
|
|
sortable
|
|
|
centered
|
|
centered
|
|
|
>
|
|
>
|
|
|
- <span :class="['tag', type(getFinalResult(props.row))]">
|
|
|
|
|
- {{ getFinalResult(props.row) }}
|
|
|
|
|
|
|
+ <span :class="['tag', type(props.row.finalRes)]">
|
|
|
|
|
+ {{ props.row.finalRes }}
|
|
|
</span>
|
|
</span>
|
|
|
</b-table-column>
|
|
</b-table-column>
|
|
|
</template>
|
|
</template>
|
|
@@ -233,28 +239,41 @@ export default {
|
|
|
submitting: false,
|
|
submitting: false,
|
|
|
isServerError: false,
|
|
isServerError: false,
|
|
|
errorMessage: "服务器错误,请稍后重试",
|
|
errorMessage: "服务器错误,请稍后重试",
|
|
|
- isResultLoading: true
|
|
|
|
|
|
|
+ isResultLoading: true,
|
|
|
|
|
+ finalResult: [],
|
|
|
|
|
+ homeworkNum: 0
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ //初始化成绩比例
|
|
|
|
|
+ initialResultPercent(studentResults) {
|
|
|
|
|
+ if (studentResults.length < 1) return;
|
|
|
|
|
+ let resultSample = studentResults[0];
|
|
|
|
|
+ let homeworkNum = 0;
|
|
|
|
|
+ homeworkNum =
|
|
|
|
|
+ resultSample.codes.length +
|
|
|
|
|
+ resultSample.documents.length +
|
|
|
|
|
+ resultSample.reviews.length;
|
|
|
|
|
+ this.homeworkNum = homeworkNum;
|
|
|
|
|
+ },
|
|
|
//统计学生成绩分段
|
|
//统计学生成绩分段
|
|
|
studenResultStatistics(studentResults) {
|
|
studenResultStatistics(studentResults) {
|
|
|
let resultStatisticsData = [];
|
|
let resultStatisticsData = [];
|
|
|
for (let i = 0; i < RESULT_PARTITION.length; i++) {
|
|
for (let i = 0; i < RESULT_PARTITION.length; i++) {
|
|
|
let count = 0;
|
|
let count = 0;
|
|
|
if (i == 0) {
|
|
if (i == 0) {
|
|
|
- for (let result in studentResults) {
|
|
|
|
|
- if (this.getFinalResult(result.row) == 0) count++;
|
|
|
|
|
|
|
+ for (let result of studentResults) {
|
|
|
|
|
+ if (result.finalRes == 0) count++;
|
|
|
}
|
|
}
|
|
|
} else if (i == RESULT_PARTITION.length - 1) {
|
|
} else if (i == RESULT_PARTITION.length - 1) {
|
|
|
- for (let result in studentResults) {
|
|
|
|
|
- if (this.getFinalResult(result.row) == 100) count++;
|
|
|
|
|
|
|
+ for (let result of studentResults) {
|
|
|
|
|
+ if (result.finalRes == 100) count++;
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- for (let result in studentResults) {
|
|
|
|
|
|
|
+ for (let result of studentResults) {
|
|
|
if (
|
|
if (
|
|
|
- this.getFinalResult(result.row) > RESULT_PARTITION[i - 1] &&
|
|
|
|
|
- this.getFinalResult(result.row) <= RESULT_PARTITION[i]
|
|
|
|
|
|
|
+ result.finalRes > RESULT_PARTITION[i - 1] &&
|
|
|
|
|
+ result.finalRes <= RESULT_PARTITION[i]
|
|
|
)
|
|
)
|
|
|
count++;
|
|
count++;
|
|
|
}
|
|
}
|
|
@@ -285,25 +304,36 @@ export default {
|
|
|
return res / resultList.length;
|
|
return res / resultList.length;
|
|
|
},
|
|
},
|
|
|
//计算总评
|
|
//计算总评
|
|
|
- getFinalResult(result) {
|
|
|
|
|
- let finalRes = 0;
|
|
|
|
|
- let currentIndex = 0;
|
|
|
|
|
- for (let docRes of result.documents) {
|
|
|
|
|
- finalRes +=
|
|
|
|
|
- docRes.score * (this.finalResultPercentage[currentIndex] / 100);
|
|
|
|
|
- currentIndex++;
|
|
|
|
|
- }
|
|
|
|
|
- for (let codeRes of result.codes) {
|
|
|
|
|
- finalRes +=
|
|
|
|
|
- codeRes.score * (this.finalResultPercentage[currentIndex] / 100);
|
|
|
|
|
- currentIndex++;
|
|
|
|
|
- }
|
|
|
|
|
- for (let reviewRes of result.reviews) {
|
|
|
|
|
- finalRes +=
|
|
|
|
|
- reviewRes.score * (this.finalResultPercentage[currentIndex] / 100);
|
|
|
|
|
- currentIndex++;
|
|
|
|
|
|
|
+ getFinalResult(resultList) {
|
|
|
|
|
+ console.log(resultList);
|
|
|
|
|
+ let finalResultList = [];
|
|
|
|
|
+ for (let i = 0; i < resultList.length; i++) {
|
|
|
|
|
+ let finalRes = 0;
|
|
|
|
|
+ let result = resultList[i];
|
|
|
|
|
+ console.log(result);
|
|
|
|
|
+ //let currentIndex = 0;
|
|
|
|
|
+ for (let docRes of result.documents) {
|
|
|
|
|
+ finalRes += docRes.score;
|
|
|
|
|
+ // finalRes +=
|
|
|
|
|
+ // docRes.score * (this.finalResultPercentage[currentIndex] / 100);
|
|
|
|
|
+ // currentIndex++;
|
|
|
|
|
+ }
|
|
|
|
|
+ for (let codeRes of result.codes) {
|
|
|
|
|
+ finalRes += codeRes.score;
|
|
|
|
|
+ // finalRes +=
|
|
|
|
|
+ // codeRes.score * (this.finalResultPercentage[currentIndex] / 100);
|
|
|
|
|
+ // currentIndex++;
|
|
|
|
|
+ }
|
|
|
|
|
+ for (let reviewRes of result.reviews) {
|
|
|
|
|
+ finalRes += reviewRes.score;
|
|
|
|
|
+ // finalRes +=
|
|
|
|
|
+ // reviewRes.score * (this.finalResultPercentage[currentIndex] / 100);
|
|
|
|
|
+ // currentIndex++;
|
|
|
|
|
+ }
|
|
|
|
|
+ result.finalRes = parseInt(finalRes / this.homeworkNum);
|
|
|
|
|
+ finalResultList.push(result);
|
|
|
}
|
|
}
|
|
|
- return parseInt(finalRes);
|
|
|
|
|
|
|
+ this.data = finalResultList;
|
|
|
},
|
|
},
|
|
|
confirmPercent() {
|
|
confirmPercent() {
|
|
|
this.submitting = true;
|
|
this.submitting = true;
|
|
@@ -318,7 +348,14 @@ export default {
|
|
|
const resultData = await getStudentFinaleResult(
|
|
const resultData = await getStudentFinaleResult(
|
|
|
this.$route.params.courseId
|
|
this.$route.params.courseId
|
|
|
);
|
|
);
|
|
|
- this.data = resultData;
|
|
|
|
|
|
|
+ this.isResultLoading = false;
|
|
|
|
|
+ this.data = resultData.data;
|
|
|
|
|
+ console.log(this.data);
|
|
|
|
|
+ //初始化默认成绩比例
|
|
|
|
|
+ this.initialResultPercent(this.data);
|
|
|
|
|
+ //统计学生总评
|
|
|
|
|
+ console.log(resultData.data);
|
|
|
|
|
+ this.getFinalResult(resultData.data);
|
|
|
//统计学生分数
|
|
//统计学生分数
|
|
|
let studentResultStatistics = this.studenResultStatistics(this.data);
|
|
let studentResultStatistics = this.studenResultStatistics(this.data);
|
|
|
//绘制图表
|
|
//绘制图表
|