Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
justlorain committed Mar 28, 2024
1 parent ac6ff96 commit b7a623a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,8 @@ func QueryContributorCountByOrg(ctx context.Context, orgNodeID string) (int, err
if err := DB.WithContext(ctx).
Table("contributors").
Select("COUNT(DISTINCT contributors.node_id) AS contributor_count").
Joins("JOIN repositories ON contributors.repo_node_id = repositories.node_id").
Joins("JOIN organizations ON repositories.owner_node_id = organizations.node_id").
Where("organizations.node_id = ?", orgNodeID).
Joins("INNER JOIN repositories ON contributors.repo_node_id = repositories.node_id").
Where("repositories.owner_node_id = ?", orgNodeID).
Scan(&contributorCount).Error; err != nil {
return 0, err
}
Expand Down
2 changes: 1 addition & 1 deletion storage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestCreateRepo(t *testing.T) {
func TestQueryContributorCountByOrg(t *testing.T) {
config.Init("../default.yaml")
Init()
count, err := QueryContributorCountByOrg(context.Background(), "MDEyOk9yZ2FuaXphdGlvbjc5MjM2NDUz")
count, err := QueryContributorCountByOrg(context.Background(), "O_kgDOCEYWXQ")
if err != nil {
panic(err.Error())
}
Expand Down

0 comments on commit b7a623a

Please sign in to comment.