@@ -411,7 +411,7 @@ func ShowTechRepo(ids []int64, show bool) error { | |||||
idStrs = append(idStrs, strconv.FormatInt(id, 10)) | idStrs = append(idStrs, strconv.FormatInt(id, 10)) | ||||
} | } | ||||
sql := "update repo_converge_info set status=? where id in (" + strings.Join(idStrs, ",") + ")" | |||||
sql := "update repo_converge_info set status=? where id in (" + strings.Join(idStrs, ",") + ") and (status=" + strconv.Itoa(TechShow) + " or status=" + strconv.Itoa(TechHide) + ")" | |||||
_, err := x.Exec(sql, status) | _, err := x.Exec(sql, status) | ||||
return err | return err | ||||
} | } | ||||
@@ -551,7 +551,7 @@ func loadRepoInfoForTech(list []*TechRepoInfo) { | |||||
techRepo.Repos = []*RepoWithInstitution{} | techRepo.Repos = []*RepoWithInstitution{} | ||||
if techRepo.RepoCount > 0 { | if techRepo.RepoCount > 0 { | ||||
var repoIds []int64 | var repoIds []int64 | ||||
x.Table("repo_converge_info").Cols("repo_id").Where("base_info_id=?", techRepo.ID).Limit(2).Desc("updated_unix").Find(&repoIds) | |||||
x.Table("repo_converge_info").Cols("repo_id").Where("base_info_id=? and status=?", techRepo.ID, TechShow).Limit(2).Desc("updated_unix").Find(&repoIds) | |||||
resultMap, err := GetRepositoriesMapByIDs(repoIds) | resultMap, err := GetRepositoriesMapByIDs(repoIds) | ||||
@@ -550,13 +550,13 @@ func RegisterRoutes(m *macaron.Macaron) { | |||||
m.Group("/tech", func() { | m.Group("/tech", func() { | ||||
m.Get("", tech.FindTech) | m.Get("", tech.FindTech) | ||||
m.Post("/basic", tech.ImportBasicInfo) | |||||
m.Post("/basic", hasRole(models.TechProgramAdmin), tech.ImportBasicInfo) | |||||
m.Get("/filter", tech.GetFilterInfo) | m.Get("/filter", tech.GetFilterInfo) | ||||
m.Get("/search", tech.SearchTechProjectInfo) | m.Get("/search", tech.SearchTechProjectInfo) | ||||
m.Get("/repo_search", tech.SearchRepoInfo) | m.Get("/repo_search", tech.SearchRepoInfo) | ||||
m.Get("/admin", tech.GetAdminRepoInfo) | |||||
m.Get("/admin", hasRole(models.TechProgramAdmin), tech.GetAdminRepoInfo) | |||||
m.Get("/my", tech.GetMyRepoInfo) | m.Get("/my", tech.GetMyRepoInfo) | ||||
m.Post("/admin/:action", bind(tech.ActionIDs{}), tech.Action) | |||||
m.Post("/admin/:action", hasRole(models.TechProgramAdmin), bind(tech.ActionIDs{}), tech.Action) | |||||
m.Post("/openi", bind(api.OpenITechRepo{}), tech.CommitOpenIRepo) | m.Post("/openi", bind(api.OpenITechRepo{}), tech.CommitOpenIRepo) | ||||
m.Post("/no_openi", bind(api.NotOpenITechRepo{}), tech.CommitNotOpenIRepo) | m.Post("/no_openi", bind(api.NotOpenITechRepo{}), tech.CommitNotOpenIRepo) | ||||
m.Get("/is_admin", tech.IsAdmin) | m.Get("/is_admin", tech.IsAdmin) | ||||