From c06dd3beba287df68a5897481bc606e14af5d8ba Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Mon, 29 Nov 2021 09:13:55 +0800 Subject: [PATCH] fix-990 fix-984 --- routers/api/v1/repo/repo_dashbord.go | 7 ++++--- routers/repo/repo_statistic.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/routers/api/v1/repo/repo_dashbord.go b/routers/api/v1/repo/repo_dashbord.go index 2926fc4f2..a8887a744 100644 --- a/routers/api/v1/repo/repo_dashbord.go +++ b/routers/api/v1/repo/repo_dashbord.go @@ -5,6 +5,7 @@ import ( "net/http" "net/url" "strconv" + "strings" "time" "github.com/360EntSecGroup-Skylar/excelize/v2" @@ -467,7 +468,7 @@ func generateCountSql(beginTime time.Time, endTime time.Time, latestDate string, "(SELECT repo_id,name,is_private,radar_total from public.repo_statistic where date='" + latestDate + "') B" + " where A.repo_id=B.repo_id" if q != "" { - countSql = countSql + " and B.name like '%" + q + "%'" + countSql = countSql + " and LOWER(B.name) like '%" + strings.ToLower(q) + "%'" } return countSql } @@ -488,7 +489,7 @@ func generateTypeAllSql(beginTime time.Time, endTime time.Time, latestDate strin " where A.repo_id=B.repo_id" if q != "" { - sql = sql + " and name like '%" + q + "%'" + sql = sql + " and LOWER(name) like '%" + strings.ToLower(q) + "%'" } sql = sql + " order by " + orderBy + " desc,repo_id" + " limit " + strconv.Itoa(pageSize) + " offset " + strconv.Itoa((page-1)*pageSize) return sql @@ -511,7 +512,7 @@ func generatePageSql(beginTime time.Time, endTime time.Time, latestDate string, "(SELECT repo_id,name,owner_name,is_private,radar_total from public.repo_statistic where date='" + latestDate + "') B" + " where A.repo_id=B.repo_id" if q != "" { - sql = sql + " and B.name like '%" + q + "%'" + sql = sql + " and LOWER(B.name) like '%" + strings.ToLower(q) + "%'" } sql = sql + " order by " + orderBy + " desc,A.repo_id" + " limit " + strconv.Itoa(pageSize) + " offset " + strconv.Itoa((page-1)*pageSize) return sql diff --git a/routers/repo/repo_statistic.go b/routers/repo/repo_statistic.go index 92e29861d..11b421659 100755 --- a/routers/repo/repo_statistic.go +++ b/routers/repo/repo_statistic.go @@ -208,7 +208,7 @@ func RepoStatisticDaily(date string) { maxRepoRadar.Completeness = tempRepoStat.Completeness } - if tempRepoStat.Liveness < minRepoRadar.Completeness { + if tempRepoStat.Liveness < minRepoRadar.Liveness { minRepoRadar.Liveness = tempRepoStat.Liveness }