Skip to content

Commit

Permalink
スコアが登録されていない時に空の配列を返すように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
KinjiKawaguchi committed Aug 8, 2024
1 parent eaa94e4 commit fbdf5a7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions typing-server/api/repository/score.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ func GetScoresRanking(ctx context.Context, client *ent.Client, request *model.Ge
All(ctx)

if err != nil {
if !ent.IsNotFound(err) {
return nil, err
if ent.IsNotFound(err) {
return &model.GetScoresRankingResponse{
Rankings: make([]*model.ScoreRanking, 0),
TotalCount: 0,
}, nil
}
return nil, err
}

rankings := make([]*model.ScoreRanking, 0, len(scores))
Expand Down

0 comments on commit fbdf5a7

Please sign in to comment.