From fe94e8bfd78872ba2073b80c7b4e5255f4ce3bbc Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 24 Nov 2021 17:47:46 +0800 Subject: [PATCH 1/6] =?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 --- routers/repo/user_data_analysis.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index a141df086..22f748ad4 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -46,6 +46,10 @@ func QueryUserStaticDataPage(ctx *context.Context) { } endTime, _ = time.ParseInLocation("2006-01-02", endDate, time.Local) endTime = endTime.AddDate(0, 0, 1) + if startDate == endDate { + startTime = startTime.AddDate(0, 0, 1) + endTime = endTime.AddDate(0, 0, 1) + } isAll = false log.Info("startTime=" + fmt.Sprint(startTime.Unix()) + " endDate=" + fmt.Sprint(endTime.Unix())) } From 17cab77f080e0068e1fdd85e35325e865165e291 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Thu, 25 Nov 2021 08:23:31 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=9A=84commit=E6=95=B0=E6=B2=A1=E6=9C=89=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/repo_activity_custom.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/models/repo_activity_custom.go b/models/repo_activity_custom.go index 7f343bdc6..672c92dac 100644 --- a/models/repo_activity_custom.go +++ b/models/repo_activity_custom.go @@ -6,6 +6,8 @@ import ( "strings" "time" + "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/git" ) @@ -213,7 +215,8 @@ func GetAllUserKPIStats() (map[string]*git.UserKPIStats, error) { for _, repository := range repositorys { authorsOneRepo, err1 := git.GetUserKPIStats(repository.RepoPath()) if err1 != nil { - return nil, err + log.Warn("get user kpi status err:"+repository.RepoPath(), err1.Error()) + continue } for key, value := range authorsOneRepo { From daf4cf6ed9525534b68b01e47b4f13d31b0d5d65 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 25 Nov 2021 09:09:15 +0800 Subject: [PATCH 3/6] =?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 --- routers/repo/user_data_analysis.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 22f748ad4..c893594bc 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -39,6 +39,7 @@ func QueryUserStaticDataPage(ctx *context.Context) { endTime = time.Now() } else { startTime, _ = time.ParseInLocation("2006-01-02", startDate, time.Local) + startTime = time.Date(startTime.Year(), startTime.Month(), startTime.Day(), 12, 0, 0, 0, startTime.Location()) settingStartTime, _ := time.Parse("2006-01-02", setting.RadarMap.RecordBeginTime) if startTime.Unix() < settingStartTime.Unix() { startTime = settingStartTime @@ -46,10 +47,8 @@ func QueryUserStaticDataPage(ctx *context.Context) { } endTime, _ = time.ParseInLocation("2006-01-02", endDate, time.Local) endTime = endTime.AddDate(0, 0, 1) - if startDate == endDate { - startTime = startTime.AddDate(0, 0, 1) - endTime = endTime.AddDate(0, 0, 1) - } + endTime = time.Date(endTime.Year(), endTime.Month(), endTime.Day(), 23, 59, 59, 0, startTime.Location()) + isAll = false log.Info("startTime=" + fmt.Sprint(startTime.Unix()) + " endDate=" + fmt.Sprint(endTime.Unix())) } From 9fdd323b8e2c20df45d74b429936f73ff842c952 Mon Sep 17 00:00:00 2001 From: Gitea Date: Thu, 25 Nov 2021 09:09:49 +0800 Subject: [PATCH 4/6] modify draw charts --- public/img/pro_new.svg | 1 + web_src/js/components/DataAnalysis.vue | 2 +- web_src/js/components/ProAnalysis.vue | 32 +++++++++++++++++++++----------- 3 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 public/img/pro_new.svg diff --git a/public/img/pro_new.svg b/public/img/pro_new.svg new file mode 100644 index 000000000..13dd3d83b --- /dev/null +++ b/public/img/pro_new.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/web_src/js/components/DataAnalysis.vue b/web_src/js/components/DataAnalysis.vue index 931f10e36..026c02bd1 100755 --- a/web_src/js/components/DataAnalysis.vue +++ b/web_src/js/components/DataAnalysis.vue @@ -13,7 +13,7 @@ - + 项目分析 diff --git a/web_src/js/components/ProAnalysis.vue b/web_src/js/components/ProAnalysis.vue index 5b61e92a0..1999abd7d 100755 --- a/web_src/js/components/ProAnalysis.vue +++ b/web_src/js/components/ProAnalysis.vue @@ -199,9 +199,9 @@
OpenI指数:{{tableDataIDTotal.openi | rounding}}
- + - +
@@ -292,7 +292,7 @@ commit -
+
@@ -712,8 +712,9 @@ params:this.paramsID }).then((res)=>{ if (bool_val){ - this.tableDataIDOpenI = res.data + this.tableDataIDOpenI = res.data this.drawOpenItrend() + }else{ @@ -925,6 +926,11 @@ ] }; this.echartsOITd.setOption(option) + // setTimeout(function (){ + // window.onresize = function () { + // this.echartsOITd.resize(); + // } + // },200) }, drawSelectData(){ @@ -1018,6 +1024,11 @@ ] }; this.echartsSelectData.setOption(this.option) + // setTimeout(function (){ + // window.onresize = function () { + // this.echartsSelectData.resize; + // } + // },200) // // 使用刚指定的选择项数据显示图表。 // var selectArr = this.echartsSelectData.getOption().legend[0].data;//legend所有值 @@ -1117,14 +1128,13 @@ mounted() { - // document.getElementById("all").style.outline="none" - // document.getElementById("all").focus() + this.getAllProList("all",7) console.log("id:"+this.pro_id); - // document.getElementById('radar_openi').style.width = document.getElementById('charts').offsetWidth*0.4+'px' - // document.getElementById('line_openi').style.width = document.getElementById('charts').offsetWidth*0.6+'px' - // document.getElementById('selectData').style.width = document.getElementById('linecharts').offsetWidth+'px' - + + document.getElementById('radar_openi').style.width = document.getElementById('pro_main').offsetWidth*0.22+'px' + document.getElementById('line_openi').style.width = document.getElementById('pro_main').offsetWidth*0.33+'px' + document.getElementById('selectData').style.width = document.getElementById('pro_main').offsetWidth*0.8+'px' this.radarOpenI = this.$echarts.init(document.getElementById('radar_openi')) this.echartsOITd = this.$echarts.init(document.getElementById('line_openi')) this.echartsSelectData = this.$echarts.init(document.getElementById('selectData')) @@ -1266,4 +1276,4 @@ margin-top: 10px; font-weight:bold; } - \ No newline at end of file + From e98ffbe644e984d4bdaed37e3293fa916a8d79cd Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 25 Nov 2021 09:13:31 +0800 Subject: [PATCH 5/6] =?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 --- routers/repo/user_data_analysis.go | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index c893594bc..2f37dc15e 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -4,7 +4,6 @@ import ( "fmt" "net/http" "net/url" - "strings" "time" "code.gitea.io/gitea/models" @@ -129,23 +128,8 @@ func QueryUserStaticDataPage(ctx *context.Context) { //设置默认打开的表单 xlsx.SetActiveSheet(index) - var filename string - nowTime := time.Now() - nowZeroTime := time.Date(nowTime.Year(), nowTime.Month(), nowTime.Day(), 0, 0, 0, 0, nowTime.Location()) - if endTime.Unix() >= nowZeroTime.Unix() { - endDate = nowZeroTime.AddDate(0, 0, -1).Format("2006-01-02") - } - - if isAll { - filename = sheetName + "_" + ctx.Tr("user.static.all") + ".xlsx" - } else { - filename = sheetName + "_" + strings.ReplaceAll(startDate, "-", "") + "_" + strings.ReplaceAll(endDate, "-", "") + ".xlsx" - } - - if len(userName) > 0 { - filename = sheetName + "_" + userName + "_" + strings.ReplaceAll(startDate, "-", "") + "_" + strings.ReplaceAll(endDate, "-", "") + ".xlsx" - } + filename := sheetName + "_" + ctx.Tr("user.static.all") + ".xlsx" ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename)) ctx.Resp.Header().Set("Content-Type", "application/octet-stream") From 30651964f76affd699db457592302947cc6e234b Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 25 Nov 2021 10:07:41 +0800 Subject: [PATCH 6/6] =?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 --- models/user_business_analysis.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index f81683242..15f67e858 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -89,7 +89,7 @@ type UserBusinessAnalysis struct { //action :ActionCommitRepo // 5 CommitCount int `xorm:"NOT NULL DEFAULT 0"` - //action :ActionCreateIssue // 10 + //action :ActionCreateIssue // 6 IssueCount int `xorm:"NOT NULL DEFAULT 0"` //comment table current date @@ -406,7 +406,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, DataDate := startTime.Format("2006-01-02") CodeMergeCountMap := queryPullRequest(start_unix, end_unix) - CommitCountMap := queryAction(start_unix, end_unix, 5) + CommitCountMap := queryCommitAction(start_unix, end_unix, 5) IssueCountMap := queryAction(start_unix, end_unix, 6) CommentCountMap := queryComment(start_unix, end_unix) @@ -674,6 +674,24 @@ func queryPullRequest(start_unix int64, end_unix int64) map[int64]int { return resultMap } +func queryCommitAction(start_unix int64, end_unix int64, actionType int64) map[int64]int { + sess := x.NewSession() + defer sess.Close() + sess.Select("id,user_id,op_type,act_user_id").Table("action").Where("user_id=act_user_id and op_type=" + fmt.Sprint(actionType) + " and created_unix>=" + fmt.Sprint(start_unix) + " and created_unix<=" + fmt.Sprint(end_unix)) + actionList := make([]*Action, 0) + sess.Find(&actionList) + resultMap := make(map[int64]int) + log.Info("query action size=" + fmt.Sprint(len(actionList))) + for _, actionRecord := range actionList { + if _, ok := resultMap[actionRecord.UserID]; !ok { + resultMap[actionRecord.UserID] = 1 + } else { + resultMap[actionRecord.UserID] += 1 + } + } + return resultMap +} + func queryAction(start_unix int64, end_unix int64, actionType int64) map[int64]int { sess := x.NewSession() defer sess.Close()