Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
pull/1788/head
zouap 3 years ago
parent
commit
dda7d94815
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      routers/home.go

+ 4
- 4
routers/home.go View File

@@ -522,10 +522,10 @@ func RecommendOrgFromPromote(ctx *context.Context) {
return return
} }
resultOrg := make([]*models.User, 0) resultOrg := make([]*models.User, 0)
for i, userName := range result {
for _, userName := range result {
user, err := models.GetUserByName(userName) user, err := models.GetUserByName(userName)
if err == nil { if err == nil {
resultOrg[i] = user
resultOrg = append(resultOrg, user)
} else { } else {
log.Info("query user error," + err.Error()) log.Info("query user error," + err.Error())
} }
@@ -570,7 +570,7 @@ func RecommendRepoFromPromote(ctx *context.Context) {
return return
} }
resultRepo := make([]*models.Repository, 0) resultRepo := make([]*models.Repository, 0)
for i, repoName := range result {
for _, repoName := range result {
tmpIndex := strings.Index(repoName, ".") tmpIndex := strings.Index(repoName, ".")
if tmpIndex == -1 { if tmpIndex == -1 {
log.Info("error repo name format.") log.Info("error repo name format.")
@@ -579,7 +579,7 @@ func RecommendRepoFromPromote(ctx *context.Context) {
repoName := strings.Trim(repoName[tmpIndex+1:], " ") repoName := strings.Trim(repoName[tmpIndex+1:], " ")
repo, err := models.GetRepositoryByOwnerAndName(ownerName, repoName) repo, err := models.GetRepositoryByOwnerAndName(ownerName, repoName)
if err == nil { if err == nil {
resultRepo[i] = repo
resultRepo = append(resultRepo, repo)
} else { } else {
log.Info("query repo error," + err.Error()) log.Info("query repo error," + err.Error())
} }


Loading…
Cancel
Save