// Copyright 2020 The Gitea Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package private import ( "net/http" "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/routers/repo" "gitea.com/macaron/macaron" ) func UpdateAllRepoCommitCnt(ctx *macaron.Context) { repos, err := models.GetAllRepositories() if err != nil { log.Error("GetAllRepositories failed:%v", err.Error(), ctx.Data["MsgID"]) ctx.JSON(http.StatusInternalServerError, map[string]string{ "error_msg": "GetAllRepositories failed", }) return } for i, repo := range repos { log.Info("%d:begin updateRepoCommitCnt(id = %d, name = %s)", i, repo.ID, repo.Name) if err = updateRepoCommitCnt(ctx, repo); err != nil { log.Error("updateRepoCommitCnt(id = %d, name = %s) failed:%v", repo.ID, repo.Name, err.Error(), ctx.Data["MsgID"]) continue } log.Info("%d:finish updateRepoCommitCnt(id = %d, name = %s)", i, repo.ID, repo.Name) } ctx.JSON(http.StatusOK, map[string]string{ "error_msg": "", }) } func RepoStatisticManually(ctx *macaron.Context) { date := ctx.Query("date") repo.RepoStatisticDaily(date) repo.SummaryStatisticDaily(date) repo.TimingCountDataByDate(date) } func CreateModel(ctx *macaron.Context) { trainTaskId := ctx.QueryInt64("TrainTask") name := ctx.Query("Name") version := ctx.Query("Version") label := ctx.Query("Label") description := ctx.Query("Description") userId := ctx.QueryInt64("userId") repo.SaveModelByParameters(trainTaskId, name, version, label, description, userId) }