提交 94dfffef authored 作者: yujiejie's avatar yujiejie

821步骤十二完成

上级 943cd4a7
...@@ -2686,7 +2686,8 @@ function getMentorDeployMissingApiTests(sid) { ...@@ -2686,7 +2686,8 @@ function getMentorDeployMissingApiTests(sid) {
function submitMentorDeployReview() { function submitMentorDeployReview() {
var sid = Number(mentorState.deployReviewStudentId); var sid = Number(mentorState.deployReviewStudentId);
var sub = getMentorDeploySubmission(sid); var taskKey = getMentorDeployTaskKey(sid);
var sub = getMentorDeploySubmission(sid, taskKey);
if (!sub) { if (!sub) {
showStudentFlowModal('无法验收', '该学生暂无提交内容。'); showStudentFlowModal('无法验收', '该学生暂无提交内容。');
return; return;
...@@ -2731,21 +2732,28 @@ function submitMentorDeployReview() { ...@@ -2731,21 +2732,28 @@ function submitMentorDeployReview() {
sub.review.round = (parseInt(sub.review.round, 10) || 0) + 1; sub.review.round = (parseInt(sub.review.round, 10) || 0) + 1;
sub.review.status = overallStatus; sub.review.status = overallStatus;
sub.review.comment = comment; sub.review.comment = comment;
sub.review.score = scores; if (conclusion === '通过') sub.review.score = scores;
sub.review.reviewedAt = reviewedAt; sub.review.reviewedAt = reviewedAt;
sub.review.notifiedAt = reviewedAt; sub.review.notifiedAt = reviewedAt;
sub.review.updatedAt = reviewedAt; // 同步到学生端 sub.review.updatedAt = reviewedAt; // 同步到学生端
// 快照本轮 API 测试结果与验收参数,避免学生重提或导师重新测试影响历史验收记录 // 快照本轮 API 测试结果与验收参数,避免学生重提或导师重新测试影响历史验收记录
sub.review.tests = JSON.parse(JSON.stringify(getMentorDeployReviewNode('tests', sid)[sid] || {})); sub.review.tests = JSON.parse(JSON.stringify(getMentorDeployReviewNode('tests', sid, taskKey)[sid] || {}));
sub.review.params = JSON.parse(JSON.stringify(getMentorDeployReviewNode('params', sid)[sid] || {})); sub.review.params = JSON.parse(JSON.stringify(getMentorDeployReviewNode('params', sid, taskKey)[sid] || {}));
// 清空本轮整体结论草稿,避免下次切换学生时残留 // 清空本轮结论 / 评分 / 评语草稿,避免下次切换学生或任务时残留
if (mentorDeployReviewState.conclusion) delete mentorDeployReviewState.conclusion[sid]; if (mentorDeployReviewState.conclusion) delete mentorDeployReviewState.conclusion[sid];
if (mentorDeployReviewState.scores && mentorDeployReviewState.scores[taskKey] && mentorDeployReviewState.scores[taskKey][sid]) {
mentorDeployReviewState.scores[taskKey][sid] = {};
}
if (mentorDeployReviewState.comments && mentorDeployReviewState.comments[taskKey] && mentorDeployReviewState.comments[taskKey][sid] !== undefined) {
delete mentorDeployReviewState.comments[taskKey][sid];
}
// 同步到 studentState(全局学生数据) // 同步到 studentState(全局学生数据)
if (typeof studentState !== 'undefined') { if (typeof studentState !== 'undefined') {
studentState.deployReviewTaskKey = taskKey;
studentState.deployReviewStatus = overallStatus; studentState.deployReviewStatus = overallStatus;
studentState.deployReviewComment = comment; studentState.deployReviewComment = comment;
studentState.deployReviewScore = scores; if (conclusion === '通过') studentState.deployReviewScore = scores;
studentState.deployReviewRound = sub.review.round; studentState.deployReviewRound = sub.review.round;
studentState.deployReviewUpdatedAt = reviewedAt; studentState.deployReviewUpdatedAt = reviewedAt;
studentState.deployReviewNotifiedAt = reviewedAt; studentState.deployReviewNotifiedAt = reviewedAt;
...@@ -2763,12 +2771,13 @@ function submitMentorDeployReview() { ...@@ -2763,12 +2771,13 @@ function submitMentorDeployReview() {
if (typeof studentState !== 'undefined') { if (typeof studentState !== 'undefined') {
if (!studentState.notifications) studentState.notifications = []; if (!studentState.notifications) studentState.notifications = [];
var message = overallStatus === '已通过' var message = overallStatus === '已通过'
? ('你的部署验收已通过,本次评分 ' + scores.total + '/100 分。') ? ('你的「' + (MENTOR_DEPLOY_TASKS[taskKey] ? MENTOR_DEPLOY_TASKS[taskKey].title : taskKey) + '」部署验收已通过,本次评分 ' + scores.total + '/100 分。')
: ('你的部署验收需要处理(结论:' + conclusion + ')。' + (comment ? '评语:' + comment : '')); : ('你的「' + (MENTOR_DEPLOY_TASKS[taskKey] ? MENTOR_DEPLOY_TASKS[taskKey].title : taskKey) + '」部署验收需要处理(结论:' + conclusion + ')。' + (comment ? '评语:' + comment : ''));
studentState.notifications.unshift({ studentState.notifications.unshift({
id: 'deploy-' + sid + '-' + reviewedAt.replace(/[^0-9]/g, ''), id: 'deploy-' + sid + '-' + taskKey + '-' + reviewedAt.replace(/[^0-9]/g, ''),
type: 'deploy-review', type: 'deploy-review',
studentId: sid, studentId: sid,
taskKey: taskKey,
round: sub.review.round, round: sub.review.round,
status: overallStatus, status: overallStatus,
title: title, title: title,
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论