|
@@ -1,6 +1,7 @@
|
|
|
import { findCurrentTaskMarkResult } from "@/components/mark/store";
|
|
|
import { httpApp } from "@/plugins/axiosApp";
|
|
|
import { Setting, UISetting } from "@/types";
|
|
|
+import { groupBy, sortBy } from "lodash";
|
|
|
|
|
|
/** 清除评卷任务(之前锁住的任务之类的) */
|
|
|
export async function clearMarkTask() {
|
|
@@ -65,11 +66,44 @@ export async function getHistoryTask({
|
|
|
export async function saveTask() {
|
|
|
const markResult = findCurrentTaskMarkResult();
|
|
|
if (markResult) {
|
|
|
- markResult.scoreList = markResult.trackList.map((t) => t.score);
|
|
|
+ const scoreGroups = groupBy(
|
|
|
+ markResult.trackList,
|
|
|
+ (obj) =>
|
|
|
+ (obj.mainNumber + "").padStart(10, "0") +
|
|
|
+ obj.subNumber.padStart(10, "0")
|
|
|
+ );
|
|
|
+ const questionWithScore = Object.entries(scoreGroups);
|
|
|
+ const questionWithTotalScore = questionWithScore.map((v) => [
|
|
|
+ v[0],
|
|
|
+ v[1].reduce((acc, c) => (acc += c.score), 0),
|
|
|
+ ]);
|
|
|
+ const questionWithTotalScoreSorted = sortBy(
|
|
|
+ questionWithTotalScore,
|
|
|
+ (obj) => obj[0]
|
|
|
+ );
|
|
|
+ const scoreList = questionWithTotalScoreSorted.map((s) => s[1]);
|
|
|
+ console.log(
|
|
|
+ scoreGroups,
|
|
|
+ questionWithScore,
|
|
|
+ questionWithTotalScore,
|
|
|
+ questionWithTotalScoreSorted,
|
|
|
+ scoreList
|
|
|
+ );
|
|
|
+ markResult.scoreList = scoreList as number[];
|
|
|
+ // const sortScore = orderBy(markResult.trackList, ['mainNumber', 'subNumber', 'score']);
|
|
|
+ // markResult.scoreList = sortScore.reduce((acc, pre) => {
|
|
|
+ // if(pre.mainNumber === cur.mainNumber && pre.subNumber === cur.subNumber) {
|
|
|
+ // acc[acc.length-1] += cur.score
|
|
|
+ // }
|
|
|
+ // }, [0])
|
|
|
+ const allScoreList = markResult.trackList.map((t) => t.score);
|
|
|
markResult.markerScore =
|
|
|
- markResult.scoreList.reduce((acc, v) => (acc += v * 100)) / 100;
|
|
|
+ markResult.trackList
|
|
|
+ .map((t) => t.score)
|
|
|
+ .reduce((acc, v) => (acc += v * 100), 0) / 100;
|
|
|
markResult.specialTagList = [];
|
|
|
markResult.problem = false;
|
|
|
+ markResult.spent = Date.now() - markResult.spent;
|
|
|
|
|
|
httpApp.post("/mark/saveTask", markResult);
|
|
|
}
|