|
@@ -15,10 +15,11 @@ class ScoreService extends CrudService {
|
|
}
|
|
}
|
|
|
|
|
|
async create(data) {
|
|
async create(data) {
|
|
- const { lessonid, stuid, teacherid, score } = data;
|
|
|
|
|
|
+ const { lessonid, stuid, teacherid, score, remark } = data;
|
|
let res = await this.model.findOne({ stuid, lessonid, teacherid });
|
|
let res = await this.model.findOne({ stuid, lessonid, teacherid });
|
|
if (res) {
|
|
if (res) {
|
|
if (score) res.score = score;
|
|
if (score) res.score = score;
|
|
|
|
+ if (remark)res.remark = remark;
|
|
res = await res.save();
|
|
res = await res.save();
|
|
} else {
|
|
} else {
|
|
res = await this.model.create(data);
|
|
res = await this.model.create(data);
|
|
@@ -29,11 +30,12 @@ class ScoreService extends CrudService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- async update({ id, score }) {
|
|
|
|
|
|
+ async update({ id, score, remark }) {
|
|
const r = await this.model.findById(id);
|
|
const r = await this.model.findById(id);
|
|
if (r) {
|
|
if (r) {
|
|
// 修改分数,重置状态,下面重新计算
|
|
// 修改分数,重置状态,下面重新计算
|
|
r.score = score;
|
|
r.score = score;
|
|
|
|
+ r.remark = remark;
|
|
await r.save();
|
|
await r.save();
|
|
}
|
|
}
|
|
this.computedScore({ teacherid: r.teacherid });
|
|
this.computedScore({ teacherid: r.teacherid });
|