Closed ryhara closed 1 week ago
[
{
"inputs": [
{
"internalType": "string",
"name": "tournamentId",
"type": "string"
},
{
"internalType": "string",
"name": "playerId",
"type": "string"
},
{
"internalType": "uint256",
"name": "score",
"type": "uint256"
}
],
"name": "addScore",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "getScore",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
},
{
"internalType": "string",
"name": "",
"type": "string"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "scores",
"outputs": [
{
"internalType": "string",
"name": "matchId",
"type": "string"
},
{
"internalType": "string",
"name": "scorerName",
"type": "string"
},
{
"internalType": "uint256",
"name": "score",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
]
0xd6cc1992c9ff6ee4207a9a3e310c569b6c2249ea
を入力for score_data in scores_data:
match_id = score_data['matchId']
score_value = score_data['score']
participant_name = score_data['participantName']
match = Match.objects.get(match_id=match_id)
Score.objects.update_or_create(
match=match,
participant_name=participant_name,
defaults={'score': score_value}
)
print(add_score(scores_data[0]['matchId'], scores_data[0]['participantName'], scores_data[0]['score']))
いけそう