|
@@ -3,6 +3,7 @@ import { InjectEntityModel } from '@midwayjs/typegoose';
|
|
|
import { ReturnModelType } from '@typegoose/typegoose';
|
|
|
import { BaseService } from 'free-midway-component';
|
|
|
import { Course } from '../entity/course.entity';
|
|
|
+import { Application } from '../entity/application.entity';
|
|
|
type modelType = ReturnModelType<typeof Course>;
|
|
|
import _ = require('lodash');
|
|
|
@Provide()
|
|
@@ -10,6 +11,9 @@ export class CourseService extends BaseService<modelType> {
|
|
|
@InjectEntityModel(Course)
|
|
|
model: modelType;
|
|
|
|
|
|
+ @InjectEntityModel(Application)
|
|
|
+ AppModel: ReturnModelType<typeof Application>;
|
|
|
+
|
|
|
|
|
|
async rankQuery(filter) {
|
|
|
const { match_id } = filter;
|
|
@@ -32,6 +36,10 @@ export class CourseService extends BaseService<modelType> {
|
|
|
|
|
|
const res = this.computedTeam(list, team_id);
|
|
|
const info = this.getOtherInfoFromList(list, team_id);
|
|
|
+ await this.AppModel.updateOne(
|
|
|
+ { team_id: team_id },
|
|
|
+ { score: res.score.toString() }
|
|
|
+ );
|
|
|
rList.push({ ...info, ...res });
|
|
|
}
|
|
|
const scoreList = _.orderBy(rList, 'score', ['desc']);
|