mindlesscloud commented on code in PR #3853:
URL: 
https://github.com/apache/incubator-devlake/pull/3853#discussion_r1039340663


##########
plugins/github/api/scope.go:
##########
@@ -137,7 +142,28 @@ func GetScopeList(input *core.ApiResourceInput) 
(*core.ApiResourceOutput, errors
        if err != nil {
                return nil, err
        }
-       return &core.ApiResourceOutput{Body: repos, Status: http.StatusOK}, nil
+       var ruleIds []uint64
+       for _, repo := range repos {
+               if repo.TransformationRuleId > 0 {
+                       ruleIds = append(ruleIds, repo.TransformationRuleId)
+               }
+       }
+       var rules []models.GithubTransformationRule
+       if len(ruleIds) > 0 {
+               err = basicRes.GetDal().All(&rules, dal.Where("id IN (?)", 
ruleIds))

Review Comment:
   That was my original plan. However, If we go with the left join way, we have 
to hard-code two tables' name and some columns' name, which could run into 
troubles as we refactor the table in the future. And this API is only invoked 
by the config-ui, performance is not an issue. Taking these factors into 
consideration, I chose the plain SQL way.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to