diff --git a/modules/context/context.go b/modules/context/context.go old mode 100644 new mode 100755 index 71c8986fb..6877780e3 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -310,9 +310,11 @@ func Contexter() macaron.Handler { ctx.Data["SignedUserID"] = ctx.User.ID ctx.Data["SignedUserName"] = ctx.User.Name ctx.Data["IsAdmin"] = ctx.User.IsAdmin + c.Data["SignedUserName"] = ctx.User.Name } else { ctx.Data["SignedUserID"] = int64(0) ctx.Data["SignedUserName"] = "" + c.Data["SignedUserName"] = "" } // If request sends files, parse them here otherwise the Query() can't be parsed and the CsrfToken will be invalid. diff --git a/public/img/org-jd@2x-80.jpg b/public/img/org-jd@2x-80.jpg index 52a0a5d50..4c99c8acc 100644 Binary files a/public/img/org-jd@2x-80.jpg and b/public/img/org-jd@2x-80.jpg differ diff --git a/routers/home.go b/routers/home.go index 70fea437c..71ba5b6c5 100755 --- a/routers/home.go +++ b/routers/home.go @@ -281,10 +281,10 @@ func ExploreDatasets(ctx *context.Context) { } pager := context.NewPagination(int(count), opts.PageSize, page, 5) + ctx.Data["Keyword"] = opts.Keyword pager.SetDefaultParams(ctx) ctx.Data["Page"] = pager - ctx.Data["Keyword"] = opts.Keyword ctx.Data["Datasets"] = datasets ctx.Data["Total"] = count ctx.Data["PageIsDatasets"] = true diff --git a/routers/repo/repo_statistic.go b/routers/repo/repo_statistic.go index 6ee5c9a59..38db0f5cb 100755 --- a/routers/repo/repo_statistic.go +++ b/routers/repo/repo_statistic.go @@ -30,11 +30,15 @@ func RepoStatisticDaily(date string) { for _, repo := range repos { log.Info("start statistic: %s", repo.Name) + var numDevMonths,numWikiViews,numContributor,numKeyContributor int64 repoGitStat, err := models.GetRepoKPIStats(repo) if err != nil { log.Error("GetRepoKPIStats failed: %s", repo.Name) - log.Error("failed statistic: %s", repo.Name) - continue + } else { + numDevMonths = repoGitStat.DevelopAge + numKeyContributor = repoGitStat.KeyContributors + numWikiViews = repoGitStat.WikiPages + numContributor = repoGitStat.Contributors } var issueFixedRate float32 @@ -42,32 +46,29 @@ func RepoStatisticDaily(date string) { issueFixedRate = float32(repo.NumClosedIssues) / float32(repo.NumIssues) } - numVersions, err := models.GetReleaseCountByRepoID(repo.ID, models.FindReleasesOptions{}) + var numVersions int64 + numVersions, err = models.GetReleaseCountByRepoID(repo.ID, models.FindReleasesOptions{}) if err != nil { - log.Error("GetReleaseCountByRepoID failed: %s", repo.Name) - log.Error("failed statistic: %s", repo.Name) - continue + log.Error("GetReleaseCountByRepoID failed(%s): %v", repo.Name, err) } - datasetSize, err := getDatasetSize(repo) + var datasetSize int64 + datasetSize, err = getDatasetSize(repo) if err != nil { - log.Error("getDatasetSize failed: %s", repo.Name) - log.Error("failed statistic: %s", repo.Name) - continue + log.Error("getDatasetSize failed(%s): %v", repo.Name, err) } - numComments, err := models.GetCommentCountByRepoID(repo.ID) + var numComments int64 + numComments, err = models.GetCommentCountByRepoID(repo.ID) if err != nil { - log.Error("GetCommentCountByRepoID failed: %s", repo.Name) - log.Error("failed statistic: %s", repo.Name) - continue + log.Error("GetCommentCountByRepoID failed(%s): %v", repo.Name, err) } beginTime, endTime := getStatTime(date) - numVisits, err := repository.AppointProjectView(repo.OwnerName, repo.Name, beginTime, endTime) + var numVisits int + numVisits, err = repository.AppointProjectView(repo.OwnerName, repo.Name, beginTime, endTime) if err != nil { - log.Error("Get numVisits failed", err) - numVisits = 0 + log.Error("AppointProjectView failed(%s): %v", repo.Name, err) } repoStat := models.RepoStatistic{ @@ -80,21 +81,21 @@ func RepoStatisticDaily(date string) { NumVisits: int64(numVisits), NumClosedIssues: int64(repo.NumClosedIssues), NumVersions: numVersions, - NumDevMonths: repoGitStat.DevelopAge, + NumDevMonths: numDevMonths, RepoSize: repo.Size, DatasetSize: datasetSize, NumModels: 0, - NumWikiViews: repoGitStat.WikiPages, + NumWikiViews: numWikiViews, NumCommits: repo.NumCommit, NumIssues: int64(repo.NumIssues), NumPulls: int64(repo.NumPulls), IssueFixedRate: issueFixedRate, - NumContributor: repoGitStat.Contributors, - NumKeyContributor: repoGitStat.KeyContributors, + NumContributor: numContributor, + NumKeyContributor: numKeyContributor, } if _, err = models.InsertRepoStat(&repoStat); err != nil { - log.Error("InsertRepoStat failed: %s", repo.Name) + log.Error("InsertRepoStat failed(%s): %v", repo.Name, err) log.Error("failed statistic: %s", repo.Name) continue } diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 0a17c832c..f6e4c9a72 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -114,14 +114,14 @@ func RouterHandler(level log.Level) func(ctx *macaron.Context) { } // SetLogMsgID set msgID in Context -func SetLogMsgID() func(ctx *macaron.Context) { +func SetLogMsgID() macaron.Handler { return func(ctx *macaron.Context) { start := time.Now() uuid := gouuid.NewV4().String() ctx.Data["MsgID"] = uuid - log.Info("Started %s %s for %s", log.ColoredMethod(ctx.Req.Method), ctx.Req.URL.RequestURI(), ctx.RemoteAddr(), ctx.Data["MsgID"]) + log.Info("%s Started %s %s for %s", ctx.Data["SignedUserName"], log.ColoredMethod(ctx.Req.Method), ctx.Req.URL.RequestURI(), ctx.RemoteAddr(), ctx.Data["MsgID"]) rw := ctx.Resp.(macaron.ResponseWriter) ctx.Next() @@ -149,7 +149,7 @@ func NewMacaron() *macaron.Macaron { m.Use(macaron.Logger()) } } - m.Use(SetLogMsgID()) + //m.Use(SetLogMsgID()) // Access Logger is similar to Router Log but more configurable and by default is more like the NCSA Common Log format if setting.EnableAccessLog { setupAccessLogger(m) @@ -257,6 +257,7 @@ func NewMacaron() *macaron.Macaron { DisableDebug: !setting.EnablePprof, })) m.Use(context.Contexter()) + m.Use(SetLogMsgID()) // OK we are now set-up enough to allow us to create a nicer recovery than // the default macaron recovery m.Use(context.Recovery()) diff --git a/templates/repo/datasets/dataset_list.tmpl b/templates/repo/datasets/dataset_list.tmpl index 5cb35aa77..e0c69c745 100755 --- a/templates/repo/datasets/dataset_list.tmpl +++ b/templates/repo/datasets/dataset_list.tmpl @@ -17,7 +17,7 @@ {{svg "octicon-file-binary" 16}} - {{if ne .DecompressState 0}} + {{if eq .DecompressState 1}}
{{svg "octicon-file-directory" 16}} {{if $.IsSigned}}