You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/12/05 09:21:37 UTC
[GitHub] [incubator-devlake] mindlesscloud commented on a diff in pull request #3853: refactor: add transformationRuleName to the scope APIs
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: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org