Skip to content
This repository was archived by the owner on Feb 4, 2021. It is now read-only.

Commit 922020e

Browse files
authored
Merge pull request #55 from gedorinku/fix_default_value
デフォルトで上位10人のcontributionが返ってくるようにした
2 parents eaa0971 + 7c56c92 commit 922020e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

app/server/contribution_conllections_server.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55

66
"github.com/izumin5210/grapi/pkg/grapiserver"
7-
"google.golang.org/grpc/grpclog"
87

98
api_pb "github.com/ProgrammingLab/prolab-accounts/api"
109
"github.com/ProgrammingLab/prolab-accounts/app/config"
@@ -32,10 +31,17 @@ type contributionConllectionServiceServerImpl struct {
3231
cfg *config.Config
3332
}
3433

34+
const (
35+
defaultContributionConllectionsLimit = 10
36+
)
37+
3538
func (s *contributionConllectionServiceServerImpl) ListContributionConllections(ctx context.Context, req *api_pb.ListContributionConllectionsRequest) (*api_pb.ListContributionConllectionsResponse, error) {
3639
gs := s.GitHubStore(ctx)
37-
grpclog.Info(req.GetUsersCount())
38-
cols, err := gs.ListContributionCollections(int(req.GetUsersCount()))
40+
limit := req.GetUsersCount()
41+
if limit == 0 {
42+
limit = defaultContributionConllectionsLimit
43+
}
44+
cols, err := gs.ListContributionCollections(int(limit))
3945
if err != nil {
4046
return nil, err
4147
}

0 commit comments

Comments
 (0)