MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / TaskCountAllTasks

Function TaskCountAllTasks

model/task.go:307–339  ·  view source on GitHub ↗

TaskCountAllTasks returns total tasks that match the given query params (admin usage)

(queryParams SyncTaskQueryParams)

Source from the content-addressed store, hash-verified

305
306// TaskCountAllTasks returns total tasks that match the given query params (admin usage)
307func TaskCountAllTasks(queryParams SyncTaskQueryParams) int64 {
308 var total int64
309 query := DB.Model(&Task{})
310 if queryParams.ChannelID != "" {
311 query = query.Where("channel_id = ?", queryParams.ChannelID)
312 }
313 if queryParams.Platform != "" {
314 query = query.Where("platform = ?", queryParams.Platform)
315 }
316 if queryParams.UserID != "" {
317 query = query.Where("user_id = ?", queryParams.UserID)
318 }
319 if len(queryParams.UserIDs) != 0 {
320 query = query.Where("user_id in (?)", queryParams.UserIDs)
321 }
322 if queryParams.TaskID != "" {
323 query = query.Where("task_id = ?", queryParams.TaskID)
324 }
325 if queryParams.Action != "" {
326 query = query.Where("action = ?", queryParams.Action)
327 }
328 if queryParams.Status != "" {
329 query = query.Where("status = ?", queryParams.Status)
330 }
331 if queryParams.StartTimestamp != 0 {
332 query = query.Where("submit_time >= ?", queryParams.StartTimestamp)
333 }
334 if queryParams.EndTimestamp != 0 {
335 query = query.Where("submit_time <= ?", queryParams.EndTimestamp)
336 }
337 _ = query.Count(&total).Error
338 return total
339}
340
341// TaskCountAllUserTask returns total tasks for given user
342func TaskCountAllUserTask(userId int, queryParams SyncTaskQueryParams) int64 {

Callers 1

GetAllTaskFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected