From 1fcabc4dbf4b2cc3c4bc1a986d2b0d74eb143e5b Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 10 Jan 2022 14:24:31 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E8=8B=B1=E6=96=87=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- options/locale/locale_en-US.ini | 47 +++++++++++++++++---------------- public/home/home.js | 4 +-- templates/base/head_navbar.tmpl | 2 +- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index d07e048bf..527bf6615 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -224,39 +224,39 @@ page_title=Explore Better AI page_small_title=OpenI AI development cooperation platform page_description=The one-stop collaborative development environment for AI field provides AI development pipeline integrating code development, data management, model debugging, reasoning and evaluation page_use=Use Now -page_only_dynamic=Show only open source project dynamics -page_recommend_org=Recommended organization -page_recommend_org_desc=These excellent organizations are using Qizhi AI to develop collaboration platforms; Your organization also wants to show here, -page_recommend_org_commit=Click here to submit -page_recommend_org_more=More organizations -page_recommend_repo=Recommended projects -page_recommend_repo_desc=Excellent AI project recommendation; Your project also wants to show here, -page_recommend_repo_commit=Click here to submit +page_only_dynamic=Only show the dynamics of open source projects +page_recommend_org=Recommended Organization +page_recommend_org_desc=These excellent organizations are using the OpenI AI Collaboration Platform for collaborative development of projects. To show your organization here, +page_recommend_org_commit=Click here to submit. +page_recommend_org_more=More Organizations +page_recommend_repo=Recommended Projects +page_recommend_repo_desc=Excellent AI projects recommendation. To show your project here, +page_recommend_repo_commit=Click here to submit. page_recommend_repo_go=. Click here page_recommend_repo_more=Project Square -page_dev_env=Collaborative development environment -page_dev_env_desc=The biggest difference between Qizhi AI collaborative development platform and traditional git platform is that it provides a collaborative development environment for AI development -page_dev_env_desc_title=Unified management of development elements +page_dev_env=Collaborative Development Environment +page_dev_env_desc=Provide a collaborative development environment for AI development, which is the biggest highlight that distinguishes the OpenI AI Collaboration Platform from other traditional Git platforms. +page_dev_env_desc_title=Unified Management of Development Elements page_dev_env_desc_desc=The platform provides four elements of AI development: unified management of model code, data set, model and execution environment -page_dev_env_desc1_title=Data collaboration and sharing -page_dev_env_desc1_desc=By uploading data sets in the project, many project members cooperate to complete data preprocessing; You can also establish a better model with community developers by setting the data as a public dataset -page_dev_env_desc2_title=Model management and sharing -page_dev_env_desc2_desc=Associate the model with the code version, adjust the model in different ways based on the code history version, and save the results; The trained model can be open and shared, so that more people can use the model to test and give feedback -page_dev_env_desc3_title=One configuration, multiple use -page_dev_env_desc3_desc=Provide execution environment sharing, one-time configuration and multiple use, reduce the threshold of model development, and avoid spending repeated time configuring complex environments -page_dev_yunlao=PengCheng Cloudbrain open source collaboration +page_dev_env_desc1_title=Data Collaboration and Sharing +page_dev_env_desc1_desc=By uploading data sets in the project, many project members cooperate to complete data preprocessing. You can also establish a better model with community developers by setting the data as a public dataset +page_dev_env_desc2_title=Model Management and Sharing +page_dev_env_desc2_desc=Associate the model with the code version, you can adjust the model in different ways based on the historical version of the code and save the results. The trained model can be open and shared, so that more people can use the model to test and give feedback +page_dev_env_desc3_title=Once Configuration, Multiple Reuse +page_dev_env_desc3_desc=Provide execution environment sharing, Once Configuration, Multiple Reuse. Lower the threshold of model development, and avoid spending repetitive time configuring complex environments +page_dev_yunlao=PengCheng Cloudbrain Open Source Collaboration page_dev_yunlao_desc1=The platform has been connected with Pengcheng Cloudbrain and can use the rich computing resources of Pengcheng Cloudbrain to complete AI development tasks -page_dev_yunlao_desc2=Pengcheng Cloudbrain's existing AI computing power is 100p FLOPS@FP16 (billions of half precision floating-point calculations per second), the main hardware infrastructure is composed of GPU server equipped with NVIDIA Tesla V100 and Atlas 900 AI cluster equipped with Kunpeng and shengteng processors -page_dev_yunlao_desc3=Developers can freely choose the corresponding computing resources according to the use requirements, and can test the adaptability, performance and stability of the model in different hardware environments -page_dev_yunlao_desc4=If your model needs more computing resources, you can also apply separately -page_dev_yunlao_apply=Separate apply +page_dev_yunlao_desc2=Pengcheng Cloudbrain's existing AI computing power is 100p FLOPS@FP16 (billions of half precision floating-point calculations per second), the main hardware infrastructure is composed of GPU server equipped with NVIDIA Tesla V100 and Atlas 900 AI cluster equipped with Kunpeng and Ascend processors +page_dev_yunlao_desc3=Developers can freely choose the corresponding computing resources according to their needs, and can test the adaptability, performance, stability of the model in different hardware environments. +page_dev_yunlao_desc4=If your model requires more computing resources, you can also apply for it separately. +page_dev_yunlao_apply=Apply Separately [explore] repos = Repositories select_repos = Select the project users = Users organizations = Organizations -images = CloudImages +images = Cloudbrain Mirror search = Search code = Code repo_no_results = No matching repositories found. @@ -2687,6 +2687,7 @@ error.unit_not_allowed = You are not allowed to access this repository section. head.community = Community head.project = Repositories head.openi = OpenI +head.openi.repo = OpenI Projects head.dataset = Datasets foot.council = Council foot.technical_committee = Technical Committee diff --git a/public/home/home.js b/public/home/home.js index 92eb86c1d..8274c3ebd 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -34,12 +34,12 @@ var swiperRepo = new Swiper(".homepro-list", { var output = document.getElementById("newmessage"); var socket = new WebSocket("ws://" + document.location.host + "/action/notification"); - +var messageQueue = []; socket.onopen = function () { + messageQueue = []; console.log("message has connected."); }; -var messageQueue = []; var maxSize = 20; var html =document.documentElement; var lang = html.attributes["lang"] diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index d1d40d1d6..d8d9d50f2 100755 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -43,7 +43,7 @@ {{if .IsOperator}} {{.i18n.Tr "explore.data_analysis"}} {{end}} - {{.i18n.Tr "custom.head.openi"}} + {{.i18n.Tr "custom.head.openi.repo"}} {{else if .IsLandingPageHome}} From bae8d0a7920ddfb18e924d2282e35022f9477c8c Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 10 Jan 2022 14:43:09 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/home.js | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/public/home/home.js b/public/home/home.js index 8274c3ebd..d3c89427e 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -159,12 +159,12 @@ function getTime(UpdatedUnix,currentTime){ var seconds= leave3; if(hours == 0 && minutes == 0){ - return seconds + getRepoOrOrg(6,isZh); + return seconds + getRepoOrOrg(6,isZh,seconds); }else{ if(hours > 0){ - return hours + getRepoOrOrg(4,isZh); + return hours + getRepoOrOrg(4,isZh,hours); }else{ - return minutes + getRepoOrOrg(5,isZh); + return minutes + getRepoOrOrg(5,isZh,minutes); } } } @@ -267,18 +267,30 @@ var repoAndOrgZH={ "1":"项目", "2":"成员", "3":"团队", + "11":"项目", + "21":"成员", + "31":"团队", "4":"小时前", "5":"分钟前", - "6":"秒前" + "6":"秒前", + "41":"小时前", + "51":"分钟前", + "61":"秒前" }; var repoAndOrgEN={ - "1":"repository", - "2":"Members ", - "3":"Teams", - "4":" hours ago", - "5":" minutes ago", - "6":" seconds ago" + "1":"Repository", + "2":"Member ", + "3":"Team", + "11":"Repository", + "22":"Member ", + "31":"Team", + "4":" hour ago", + "5":" minute ago", + "6":" second ago", + "41":" hours ago", + "51":" minutes ago", + "61":" seconds ago" }; @@ -409,7 +421,10 @@ function displayRepo(json){ //var repoAndOrgEN = new Map([['1', "Repository"], ['2', "Members"], ['3', "Teams"]]); -function getRepoOrOrg(key,isZhLang){ +function getRepoOrOrg(key,isZhLang,numbers=1){ + if(numbers > 1){ + key+="1"; + } if(isZhLang){ return repoAndOrgZH[key]; }else{ @@ -430,7 +445,7 @@ function displayOrg(json){ html += " "; html += "
"; html += " " + record["Name"] + " " + record["FullName"]; - html += "
" + record["NumRepos"] +" " + getRepoOrOrg(1,isZh) + " ・ " + record["NumMembers"] +" " + getRepoOrOrg(2,isZh) + " ・ " + record["NumTeams"] + " " + getRepoOrOrg(3,isZh) + "
"; + html += "
" + record["NumRepos"] +" " + getRepoOrOrg(1,isZh,record["NumRepos"]) + " ・ " + record["NumMembers"] +" " + getRepoOrOrg(2,isZh,record["NumMembers"]) + " ・ " + record["NumTeams"] + " " + getRepoOrOrg(3,isZh,record["NumTeams"]) + "
"; html += "
"; html += " "; html += " "; From fbd2d5e559eeebf8a2975113806fe9816eb775e7 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 10 Jan 2022 15:00:21 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- options/locale/locale_en-US.ini | 2 +- public/home/home.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 527bf6615..17f52814e 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -221,7 +221,7 @@ issues.in_your_repos = In your repositories contributors = Contributors page_title=Explore Better AI -page_small_title=OpenI AI development cooperation platform +page_small_title=OpenI AI Development Cooperation Platform page_description=The one-stop collaborative development environment for AI field provides AI development pipeline integrating code development, data management, model debugging, reasoning and evaluation page_use=Use Now page_only_dynamic=Only show the dynamics of open source projects diff --git a/public/home/home.js b/public/home/home.js index d3c89427e..bef54bbd4 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -282,9 +282,9 @@ var repoAndOrgEN={ "1":"Repository", "2":"Member ", "3":"Team", - "11":"Repository", - "22":"Member ", - "31":"Team", + "11":"Repositorys", + "22":"Members ", + "31":"Teams", "4":" hour ago", "5":" minute ago", "6":" second ago", From 382fe00563b77b60474580dab1e06e0dd9257ba0 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 10 Jan 2022 15:09:30 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- options/locale/locale_en-US.ini | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 17f52814e..1701df598 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -232,21 +232,21 @@ page_recommend_org_more=More Organizations page_recommend_repo=Recommended Projects page_recommend_repo_desc=Excellent AI projects recommendation. To show your project here, page_recommend_repo_commit=Click here to submit. -page_recommend_repo_go=. Click here -page_recommend_repo_more=Project Square +page_recommend_repo_go= Click here to +page_recommend_repo_more= explore more projects. page_dev_env=Collaborative Development Environment page_dev_env_desc=Provide a collaborative development environment for AI development, which is the biggest highlight that distinguishes the OpenI AI Collaboration Platform from other traditional Git platforms. page_dev_env_desc_title=Unified Management of Development Elements -page_dev_env_desc_desc=The platform provides four elements of AI development: unified management of model code, data set, model and execution environment +page_dev_env_desc_desc=The platform provides four elements of AI development: unified management of model code, data set, model and execution environment. page_dev_env_desc1_title=Data Collaboration and Sharing -page_dev_env_desc1_desc=By uploading data sets in the project, many project members cooperate to complete data preprocessing. You can also establish a better model with community developers by setting the data as a public dataset +page_dev_env_desc1_desc=By uploading data sets in the project, many project members cooperate to complete data preprocessing. You can also establish a better model with community developers by setting the data as a public dataset. page_dev_env_desc2_title=Model Management and Sharing -page_dev_env_desc2_desc=Associate the model with the code version, you can adjust the model in different ways based on the historical version of the code and save the results. The trained model can be open and shared, so that more people can use the model to test and give feedback +page_dev_env_desc2_desc=Associate the model with the code version, you can adjust the model in different ways based on the historical version of the code and save the results. The trained model can be open and shared, so that more people can use the model to test and give feedback. page_dev_env_desc3_title=Once Configuration, Multiple Reuse -page_dev_env_desc3_desc=Provide execution environment sharing, Once Configuration, Multiple Reuse. Lower the threshold of model development, and avoid spending repetitive time configuring complex environments +page_dev_env_desc3_desc=Provide execution environment sharing, Once Configuration, Multiple Reuse. Lower the threshold of model development, and avoid spending repetitive time configuring complex environments. page_dev_yunlao=PengCheng Cloudbrain Open Source Collaboration -page_dev_yunlao_desc1=The platform has been connected with Pengcheng Cloudbrain and can use the rich computing resources of Pengcheng Cloudbrain to complete AI development tasks -page_dev_yunlao_desc2=Pengcheng Cloudbrain's existing AI computing power is 100p FLOPS@FP16 (billions of half precision floating-point calculations per second), the main hardware infrastructure is composed of GPU server equipped with NVIDIA Tesla V100 and Atlas 900 AI cluster equipped with Kunpeng and Ascend processors +page_dev_yunlao_desc1=The platform has been connected with Pengcheng Cloudbrain and can use the rich computing resources of Pengcheng Cloudbrain to complete AI development tasks. +page_dev_yunlao_desc2=Pengcheng Cloudbrain's existing AI computing power is 100p FLOPS@FP16 (billions of half precision floating-point calculations per second), the main hardware infrastructure is composed of GPU server equipped with NVIDIA Tesla V100 and Atlas 900 AI cluster equipped with Kunpeng and Ascend processors. page_dev_yunlao_desc3=Developers can freely choose the corresponding computing resources according to their needs, and can test the adaptability, performance, stability of the model in different hardware environments. page_dev_yunlao_desc4=If your model requires more computing resources, you can also apply for it separately. page_dev_yunlao_apply=Apply Separately From 63e7dea4d4d217c579f21a7e848a9fcce294ec77 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 10 Jan 2022 15:11:03 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 1701df598..4ba5923e0 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -232,7 +232,7 @@ page_recommend_org_more=More Organizations page_recommend_repo=Recommended Projects page_recommend_repo_desc=Excellent AI projects recommendation. To show your project here, page_recommend_repo_commit=Click here to submit. -page_recommend_repo_go= Click here to +page_recommend_repo_go= Click here to page_recommend_repo_more= explore more projects. page_dev_env=Collaborative Development Environment page_dev_env_desc=Provide a collaborative development environment for AI development, which is the biggest highlight that distinguishes the OpenI AI Collaboration Platform from other traditional Git platforms. From 0ae935c5e58cd221991c9d8312b8e5ca5bf71667 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 10 Jan 2022 15:14:19 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 4ba5923e0..793005d1a 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -233,7 +233,7 @@ page_recommend_repo=Recommended Projects page_recommend_repo_desc=Excellent AI projects recommendation. To show your project here, page_recommend_repo_commit=Click here to submit. page_recommend_repo_go= Click here to -page_recommend_repo_more= explore more projects. +page_recommend_repo_more= explore more projects. page_dev_env=Collaborative Development Environment page_dev_env_desc=Provide a collaborative development environment for AI development, which is the biggest highlight that distinguishes the OpenI AI Collaboration Platform from other traditional Git platforms. page_dev_env_desc_title=Unified Management of Development Elements From dd0b486bcbabfcea58805de7127b86c938c3f6b6 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 10 Jan 2022 15:17:36 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- options/locale/locale_en-US.ini | 4 ++-- templates/home.tmpl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 793005d1a..21890babe 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -232,8 +232,8 @@ page_recommend_org_more=More Organizations page_recommend_repo=Recommended Projects page_recommend_repo_desc=Excellent AI projects recommendation. To show your project here, page_recommend_repo_commit=Click here to submit. -page_recommend_repo_go= Click here to -page_recommend_repo_more= explore more projects. +page_recommend_repo_go=Click here to +page_recommend_repo_more=explore more projects. page_dev_env=Collaborative Development Environment page_dev_env_desc=Provide a collaborative development environment for AI development, which is the biggest highlight that distinguishes the OpenI AI Collaboration Platform from other traditional Git platforms. page_dev_env_desc_title=Unified Management of Development Elements diff --git a/templates/home.tmpl b/templates/home.tmpl index 3a1cca49e..2737afd54 100755 --- a/templates/home.tmpl +++ b/templates/home.tmpl @@ -57,7 +57,7 @@

{{.page_recommend_repo}}

-

{{.page_recommend_repo_desc}}{{.page_recommend_repo_commit}}{{.page_recommend_repo_go}}{{.page_recommend_repo_more}}

+

{{.page_recommend_repo_desc}}{{.page_recommend_repo_commit}}{{.page_recommend_repo_go}} {{.page_recommend_repo_more}}

From 51836a5ddc87fa3cd41ff69f20042fd8a3f29dbd Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Tue, 11 Jan 2022 15:12:12 +0800 Subject: [PATCH 8/9] fix-1311 --- models/action.go | 4 ++-- services/socketwrap/clientManager.go | 31 +++++++++++++++++++++------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/models/action.go b/models/action.go index e2958821c..b9a0a603c 100755 --- a/models/action.go +++ b/models/action.go @@ -346,11 +346,11 @@ func GetFeeds(opts GetFeedsOptions) ([]*Action, error) { return actions, nil } -func GetLast20PublicFeeds() ([]*Action, error) { +func GetLast20PublicFeeds(opTypes []int) ([]*Action, error) { cond := builder.NewCond() cond = cond.And(builder.Eq{"is_private": false}) cond = cond.And(builder.Eq{"is_deleted": false}) - + cond = cond.And(builder.In("op_type", opTypes)) actions := make([]*Action, 0, 20) diff --git a/services/socketwrap/clientManager.go b/services/socketwrap/clientManager.go index eeb496108..c59936581 100644 --- a/services/socketwrap/clientManager.go +++ b/services/socketwrap/clientManager.go @@ -10,6 +10,8 @@ import ( "github.com/elliotchance/orderedmap" ) +var opTypes = []int{1, 2, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 22, 23} + type ClientsManager struct { Clients *orderedmap.OrderedMap Register chan *Client @@ -47,13 +49,15 @@ func (h *ClientsManager) Run() { close(client.Send) } case message := <-models.ActionChan: - LastActionsQueue.Push(message) - for _, client := range h.Clients.Keys() { - select { - case client.(*Client).Send <- message: - default: - close(client.(*Client).Send) - h.Clients.Delete(client) + if isInOpTypes(opTypes, message.OpType) { + LastActionsQueue.Push(message) + for _, client := range h.Clients.Keys() { + select { + case client.(*Client).Send <- message: + default: + close(client.(*Client).Send) + h.Clients.Delete(client) + } } } case s := <-sig: @@ -71,8 +75,19 @@ func (h *ClientsManager) Run() { } } +func isInOpTypes(types []int, opType models.ActionType) bool { + isFound := false + for _, value := range types { + if value == int(opType) { + isFound = true + break + } + } + return isFound +} + func initActionQueue() { - actions, err := models.GetLast20PublicFeeds() + actions, err := models.GetLast20PublicFeeds(opTypes) if err == nil { for i := len(actions) - 1; i >= 0; i-- { From 34189256f0fa9df7f2dc6b25113a7988df209d2a Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Tue, 11 Jan 2022 15:27:23 +0800 Subject: [PATCH 9/9] fix-1309 --- routers/repo/repo_statistic.go | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/routers/repo/repo_statistic.go b/routers/repo/repo_statistic.go index 11b421659..dce183f49 100755 --- a/routers/repo/repo_statistic.go +++ b/routers/repo/repo_statistic.go @@ -51,12 +51,14 @@ func RepoStatisticDaily(date string) { isInitMinMaxRadar := false + var error_projects = make([]string, 0) for _, repo := range repos { - log.Info("start statistic: %s", getDistinctProjectName(repo)) + projectName := getDistinctProjectName(repo) + log.Info("start statistic: %s", projectName) var numDevMonths, numWikiViews, numContributor, numKeyContributor, numCommitsGrowth, numCommitLinesGrowth, numContributorsGrowth, numCommits int64 repoGitStat, err := models.GetRepoKPIStats(repo) if err != nil { - log.Error("GetRepoKPIStats failed: %s", getDistinctProjectName(repo)) + log.Error("GetRepoKPIStats failed: %s", projectName) } else { numDevMonths = repoGitStat.DevelopAge numKeyContributor = repoGitStat.KeyContributors @@ -79,26 +81,26 @@ func RepoStatisticDaily(date string) { var numVersions int64 numVersions, err = models.GetReleaseCountByRepoID(repo.ID, models.FindReleasesOptions{}) if err != nil { - log.Error("GetReleaseCountByRepoID failed(%s): %v", getDistinctProjectName(repo), err) + log.Error("GetReleaseCountByRepoID failed(%s): %v", projectName, err) } var datasetSize int64 datasetSize, err = getDatasetSize(repo) if err != nil { - log.Error("getDatasetSize failed(%s): %v", getDistinctProjectName(repo), err) + log.Error("getDatasetSize failed(%s): %v", projectName, err) } var numComments int64 numComments, err = models.GetCommentCountByRepoID(repo.ID) if err != nil { - log.Error("GetCommentCountByRepoID failed(%s): %v", getDistinctProjectName(repo), err) + log.Error("GetCommentCountByRepoID failed(%s): %v", projectName, err) } beginTime, endTime := getStatTime(date) var numVisits int numVisits, err = repository.AppointProjectView(repo.OwnerName, repo.Name, beginTime, endTime) if err != nil { - log.Error("AppointProjectView failed(%s): %v", getDistinctProjectName(repo), err) + log.Error("AppointProjectView failed(%s): %v", projectName, err) } repoStat := models.RepoStatistic{ @@ -162,9 +164,10 @@ func RepoStatisticDaily(date string) { } if _, err = models.InsertRepoStat(&repoStat); err != nil { - log.Error("InsertRepoStat failed(%s): %v", getDistinctProjectName(repo), err) - log.Error("failed statistic: %s", getDistinctProjectName(repo)) - mailer.SendWarnNotifyMail(setting.Warn_Notify_Mails, warnEmailMessage) + log.Error("InsertRepoStat failed(%s): %v", projectName, err) + log.Error("failed statistic: %s", projectName) + error_projects = append(error_projects, projectName) + continue } @@ -247,6 +250,10 @@ func RepoStatisticDaily(date string) { log.Info("finish statistic: %s", getDistinctProjectName(repo)) } + if len(error_projects) > 0 { + mailer.SendWarnNotifyMail(setting.Warn_Notify_Mails, warnEmailMessage) + } + //radar map log.Info("begin statistic radar") for _, radarInit := range reposRadar {