Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
tabulator-another
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
tabulator-another
Commits
82191785
Commit
82191785
authored
May 22, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow restart match
parent
8863ec48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
src/match/match.service.ts
src/match/match.service.ts
+12
-2
No files found.
src/match/match.service.ts
View file @
82191785
...
@@ -68,7 +68,10 @@ export class MatchService extends CrudService(Match, {
...
@@ -68,7 +68,10 @@ export class MatchService extends CrudService(Match, {
'
对局胜者不在对局中。
'
,
'
对局胜者不在对局中。
'
,
).
toException
();
).
toException
();
}
}
if
(
match
.
status
===
MatchStatus
.
Pending
)
{
if
(
match
.
status
===
MatchStatus
.
Pending
||
match
.
status
===
MatchStatus
.
Abandoned
)
{
throw
new
BlankReturnMessageDto
(
throw
new
BlankReturnMessageDto
(
400
,
400
,
'
对局尚未开始,无法修改。
'
,
'
对局尚未开始,无法修改。
'
,
...
@@ -92,7 +95,11 @@ export class MatchService extends CrudService(Match, {
...
@@ -92,7 +95,11 @@ export class MatchService extends CrudService(Match, {
if
(
dto
.
winnerId
!==
undefined
)
{
if
(
dto
.
winnerId
!==
undefined
)
{
dto
.
status
=
MatchStatus
.
Finished
;
dto
.
status
=
MatchStatus
.
Finished
;
}
}
if
(
match
.
status
===
MatchStatus
.
Finished
&&
dto
.
winnerId
!==
undefined
)
{
if
(
match
.
status
===
MatchStatus
.
Finished
&&
(
dto
.
winnerId
!==
undefined
||
(
dto
.
player1Score
===
0
&&
dto
.
player2Score
===
0
))
)
{
// clean all other matches in greater rounds
// clean all other matches in greater rounds
await
this
.
repo
.
update
(
await
this
.
repo
.
update
(
{
round
:
MoreThan
(
match
.
round
),
tournamentId
:
match
.
tournamentId
},
{
round
:
MoreThan
(
match
.
round
),
tournamentId
:
match
.
tournamentId
},
...
@@ -107,6 +114,9 @@ export class MatchService extends CrudService(Match, {
...
@@ -107,6 +114,9 @@ export class MatchService extends CrudService(Match, {
);
);
}
}
dto
.
winnerId
||=
null
;
dto
.
winnerId
||=
null
;
if
(
dto
.
player1Score
===
0
&&
dto
.
player2Score
===
0
)
{
dto
.
status
=
MatchStatus
.
Pending
;
}
const
result
=
await
this
.
update
(
id
,
dto
);
const
result
=
await
this
.
update
(
id
,
dto
);
await
this
.
tournamentService
.
afterMatchUpdate
(
match
.
tournamentId
);
await
this
.
tournamentService
.
afterMatchUpdate
(
match
.
tournamentId
);
return
result
;
return
result
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment