Browse Source

Merge branch 'V20211213' into liuzx_trainjob

pull/1076/head
zhoupzh 3 years ago
parent
commit
29114aad9a
3 changed files with 590 additions and 321 deletions
  1. +553
    -312
      models/user_business_analysis.go
  2. +3
    -9
      routers/repo/user_data_analysis.go
  3. +34
    -0
      routers/user/profile.go

+ 553
- 312
models/user_business_analysis.go
File diff suppressed because it is too large
View File


+ 3
- 9
routers/repo/user_data_analysis.go View File

@@ -148,11 +148,6 @@ func QueryUserStaticDataPage(ctx *context.Context) {

func TimingCountDataByDateAndReCount(date string, isReCount bool) {

if date == "refreshAll" {
models.RefreshUserStaticAllTabel()
return
}

t, _ := time.Parse("2006-01-02", date)
startTime := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())

@@ -205,10 +200,9 @@ func TimingCountDataByDateAndReCount(date string, isReCount bool) {
log.Error("count user info error." + err.Error())
mailer.SendWarnNotifyMail(setting.Warn_Notify_Mails, warnEmailMessage)
}

if isReCount {
models.RefreshUserStaticAllTabel()
}
log.Info("start to count all user info data")
//models.RefreshUserStaticAllTabel(wikiMap)
log.Info("end to count all user info data")
}

func TimingCountDataByDate(date string) {


+ 34
- 0
routers/user/profile.go View File

@@ -104,6 +104,40 @@ func Profile(ctx *context.Context) {
return
}

for _, org := range orgs {
_, repoCount, err := models.SearchRepository(&models.SearchRepoOptions{
OwnerID: org.ID,
Private: ctx.IsSigned,
Actor: ctx.User,
})
if err != nil {
ctx.ServerError("SearchRepository", err)
return
}

var opts = models.FindOrgMembersOpts{
OrgID: org.ID,
PublicOnly: true,
}

if ctx.User != nil {
isMember, err := org.IsOrgMember(ctx.User.ID)
if err != nil {
ctx.Error(500, "IsOrgMember")
return
}
opts.PublicOnly = !isMember && !ctx.User.IsAdmin
}

membersCount, err := models.CountOrgMembers(opts)
if err != nil {
ctx.ServerError("CountOrgMembers", err)
return
}
org.NumMembers = int(membersCount)
org.NumRepos = int(repoCount)
}

ctx.Data["Orgs"] = orgs
ctx.Data["HasOrgsVisible"] = models.HasOrgsVisible(orgs, ctx.User)



Loading…
Cancel
Save