You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

tool.go 1.6 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package private
  5. import (
  6. "net/http"
  7. "code.gitea.io/gitea/models"
  8. "code.gitea.io/gitea/modules/log"
  9. "code.gitea.io/gitea/routers/repo"
  10. "gitea.com/macaron/macaron"
  11. )
  12. func UpdateAllRepoCommitCnt(ctx *macaron.Context) {
  13. repos, err := models.GetAllRepositories()
  14. if err != nil {
  15. log.Error("GetAllRepositories failed:%v", err.Error(), ctx.Data["MsgID"])
  16. ctx.JSON(http.StatusInternalServerError, map[string]string{
  17. "error_msg": "GetAllRepositories failed",
  18. })
  19. return
  20. }
  21. for i, repo := range repos {
  22. log.Info("%d:begin updateRepoCommitCnt(id = %d, name = %s)", i, repo.ID, repo.Name)
  23. if err = updateRepoCommitCnt(ctx, repo); err != nil {
  24. log.Error("updateRepoCommitCnt(id = %d, name = %s) failed:%v", repo.ID, repo.Name, err.Error(), ctx.Data["MsgID"])
  25. continue
  26. }
  27. log.Info("%d:finish updateRepoCommitCnt(id = %d, name = %s)", i, repo.ID, repo.Name)
  28. }
  29. ctx.JSON(http.StatusOK, map[string]string{
  30. "error_msg": "",
  31. })
  32. }
  33. func RepoStatisticManually(ctx *macaron.Context) {
  34. date := ctx.Query("date")
  35. repo.RepoStatisticDaily(date)
  36. repo.SummaryStatisticDaily(date)
  37. repo.TimingCountDataByDate(date)
  38. }
  39. func CreateModel(ctx *macaron.Context) {
  40. trainTaskId := ctx.QueryInt64("TrainTask")
  41. name := ctx.Query("Name")
  42. version := ctx.Query("Version")
  43. label := ctx.Query("Label")
  44. description := ctx.Query("Description")
  45. userId := ctx.QueryInt64("userId")
  46. repo.SaveModelByParameters(trainTaskId, name, version, label, description, userId)
  47. }