Commit 6caf4810 authored by nanahira's avatar nanahira

remove match tree

parent 345755c3
......@@ -22,7 +22,7 @@
"lodash": "^4.17.21",
"nesties": "^1.1.1",
"nestjs-mycard": "^4.0.2",
"nicot": "^1.1.13",
"nicot": "^1.1.17",
"pg": "^8.14.1",
"pg-native": "^3.3.0",
"reflect-metadata": "^0.2.2",
......@@ -6352,6 +6352,12 @@
"node": ">= 0.6"
}
},
"node_modules/eventemitter3": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
"license": "MIT"
},
"node_modules/events": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
......@@ -9061,13 +9067,14 @@
}
},
"node_modules/nicot": {
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/nicot/-/nicot-1.1.13.tgz",
"integrity": "sha512-uBDjRUx/jmuUGxQeC/KtmkP8C/QIZYRYJMYJuszAV7M1Na+Um9hnHTcTWeSK+whrXoIEt8bJlERFn/CnRTi06A==",
"version": "1.1.17",
"resolved": "https://registry.npmjs.org/nicot/-/nicot-1.1.17.tgz",
"integrity": "sha512-80Bj537a/KJZNbK5RyAf0NNzrmtygQuX0OOAkLGlmYwaTxmSqNTJ/NyWiao+ObUIu6GG3HM68erhcxSgK6ihhA==",
"license": "MIT",
"dependencies": {
"lodash": "^4.17.21",
"nesties": "^1.1.2",
"p-queue": "6.6.2",
"superjson": "1.13.3",
"typed-reflector": "^1.0.11"
},
......@@ -9290,6 +9297,15 @@
"node": ">=12.20"
}
},
"node_modules/p-finally": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
"integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==",
"license": "MIT",
"engines": {
"node": ">=4"
}
},
"node_modules/p-limit": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
......@@ -9322,6 +9338,34 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-queue": {
"version": "6.6.2",
"resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz",
"integrity": "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==",
"license": "MIT",
"dependencies": {
"eventemitter3": "^4.0.4",
"p-timeout": "^3.2.0"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-timeout": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz",
"integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==",
"license": "MIT",
"dependencies": {
"p-finally": "^1.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
......
......@@ -134,6 +134,7 @@ export class Match extends IdBase() {
return this.player1Id === id ? this.player2Id : this.player1Id;
}
/*
clone() {
const match = new Match();
Object.assign(match, this);
......@@ -146,4 +147,5 @@ export class Match extends IdBase() {
.map((match) => match.clone().buildTree(matches));
return this;
}
*/
}
......@@ -158,12 +158,14 @@ export class Tournament extends DescBase {
@OneToMany(() => Match, (match) => match.tournament)
matches: Match[];
/*
@NotColumn()
@ApiProperty({
description: '对阵图树',
})
@RelationComputed()
matchTree: Match;
*/
async beforeCreate() {
this.createdAt = new Date();
......@@ -234,6 +236,7 @@ export class Tournament extends DescBase {
});
}
/*
calculateTree() {
const finalMatch = _.maxBy(
this.matches.filter((m) => !m.isThirdPlaceMatch),
......@@ -241,6 +244,7 @@ export class Tournament extends DescBase {
);
this.matchTree = finalMatch.clone().buildTree(this.matches);
}
*/
analytics() {
if (!this.participants || this.status === TournamentStatus.Ready) {
......@@ -248,7 +252,7 @@ export class Tournament extends DescBase {
}
this.calculateScore();
if (this.rule === TournamentRule.SingleElimination) {
this.calculateTree();
// this.calculateTree();
}
}
}
......@@ -17,6 +17,7 @@ const factory = new RestfulFactory(Tournament, {
'matches.player1',
'matches.player2',
'matches.winner',
/*
'matchTree',
'matchTree.player1',
'matchTree.player2',
......@@ -29,6 +30,7 @@ const factory = new RestfulFactory(Tournament, {
'matchTree.parentMatches.parentMatches.player1',
'matchTree.parentMatches.parentMatches.player2',
'matchTree.parentMatches.parentMatches.winner',
*/
],
});
class CreateTournamentDto extends factory.createDto {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment