Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
challonge-migrator
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
nanahira
challonge-migrator
Commits
f83e1901
Commit
f83e1901
authored
Jan 30, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
218c06c8
Pipeline
#2282
passed with stages
in 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
migrate.ts
migrate.ts
+5
-5
No files found.
migrate.ts
View file @
f83e1901
...
...
@@ -62,7 +62,7 @@ async function checkQuit(round: number, oldPlayerId: number) {
await
axios
.
delete
(
`https://api.challonge.com/v1/tournaments/
${
config
.
targetTournament
}
/participants/
${
newPlayerId
}
.json?api_key=
${
encodeURIComponent
(
config
.
apiKey
)}
`
,
{
responseType
:
'
json
'
});
console
.
log
(
`Successfully quitt
ing
player
${
oldPlayer
.
name
}
in round
${
round
}
.`
);
console
.
log
(
`Successfully quitt
ed
player
${
oldPlayer
.
name
}
in round
${
round
}
.`
);
}
catch
(
e
)
{
console
.
log
(
`Failed quitting player
${
oldPlayer
.
name
}
in round
${
round
}
:
${
e
.
toString
()}
`
);
}
...
...
@@ -85,13 +85,13 @@ async function migrateMatch(match: Match) {
return
;
}
let
winner_id
:
string
|
number
;
if
(
oldMatch
.
winner_id
===
"
tie
"
)
{
winner_id
=
"
tie
"
;
console
.
log
(
`Migrating match
${
currentMatchPlayer1Name
}
vs
${
currentMatchPlayer2Name
}
with tie.`
);
}
else
{
if
(
typeof
(
oldMatch
.
winner_id
)
===
"
number
"
)
{
const
winnerName
=
oldParticipantIdMap
.
get
(
oldMatch
.
winner_id
as
number
).
name
;
winner_id
=
newParticipantNameMap
.
get
(
winnerName
).
id
;
console
.
log
(
`Migrating match
${
currentMatchPlayer1Name
}
vs
${
currentMatchPlayer2Name
}
with winner
${
winnerName
}
.`
);
}
else
{
winner_id
=
oldMatch
.
winner_id
;
console
.
log
(
`Migrating match
${
currentMatchPlayer1Name
}
vs
${
currentMatchPlayer2Name
}
with result
${
winner_id
}
.`
);
}
const
oldPlayerIds
=
[
oldMatch
.
player1_id
,
oldMatch
.
player2_id
]
await
Promise
.
all
(
oldPlayerIds
.
map
(
pid
=>
checkQuit
(
match
.
round
,
pid
)));
...
...
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