mirror of
https://github.com/go-gitea/gitea.git
synced 2025-04-08 17:05:45 +02:00
fix: omit total in FindTasks
This commit is contained in:
parent
5d938ebf4e
commit
7f6a803d24
@ -88,7 +88,7 @@ func (opts FindTaskOptions) toConds() builder.Cond {
|
||||
return cond
|
||||
}
|
||||
|
||||
func FindTasks(ctx context.Context, opts FindTaskOptions) (TaskList, int64, error) {
|
||||
func FindTasks(ctx context.Context, opts FindTaskOptions) (TaskList, error) {
|
||||
e := db.GetEngine(ctx).Where(opts.toConds())
|
||||
if opts.PageSize > 0 && opts.Page >= 1 {
|
||||
e.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize)
|
||||
@ -97,8 +97,7 @@ func FindTasks(ctx context.Context, opts FindTaskOptions) (TaskList, int64, erro
|
||||
e.OrderBy("id DESC")
|
||||
}
|
||||
var tasks TaskList
|
||||
total, err := e.FindAndCount(&tasks)
|
||||
return tasks, total, err
|
||||
return tasks, e.Find(&tasks)
|
||||
}
|
||||
|
||||
func CountTasks(ctx context.Context, opts FindTaskOptions) (int64, error) {
|
||||
|
@ -98,7 +98,7 @@ func RunnerDetails(ctx *context.Context, tplName base.TplName, page int, runnerI
|
||||
return
|
||||
}
|
||||
|
||||
tasks, _, err := actions_model.FindTasks(ctx, opts)
|
||||
tasks, err := actions_model.FindTasks(ctx, opts)
|
||||
if err != nil {
|
||||
ctx.ServerError("FindTasks", err)
|
||||
return
|
||||
|
@ -34,7 +34,7 @@ func Init() {
|
||||
}
|
||||
|
||||
func DeleteResourceOfRepository(ctx context.Context, repo *repo_model.Repository) error {
|
||||
tasks, _, err := actions_model.FindTasks(ctx, actions_model.FindTaskOptions{RepoID: repo.ID})
|
||||
tasks, err := actions_model.FindTasks(ctx, actions_model.FindTaskOptions{RepoID: repo.ID})
|
||||
if err != nil {
|
||||
return fmt.Errorf("find task of repo %v: %w", repo.ID, err)
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ func StopEndlessTasks(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func stopTasks(ctx context.Context, opts actions_model.FindTaskOptions) error {
|
||||
tasks, _, err := actions_model.FindTasks(ctx, opts)
|
||||
tasks, err := actions_model.FindTasks(ctx, opts)
|
||||
if err != nil {
|
||||
return fmt.Errorf("find tasks: %w", err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user