6.17.0: Счётчик подзадач с учётом драфта
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -353,6 +353,7 @@ type Task struct {
|
||||
HasProgression bool `json:"has_progression"`
|
||||
AutoComplete bool `json:"auto_complete"`
|
||||
DraftProgressionValue *float64 `json:"draft_progression_value,omitempty"`
|
||||
DraftSubtasksCount *int `json:"draft_subtasks_count,omitempty"`
|
||||
}
|
||||
|
||||
type Reward struct {
|
||||
@@ -8492,7 +8493,8 @@ func (a *App) fetchTasksForUser(userID int) ([]Task, error) {
|
||||
ARRAY[]::text[]
|
||||
) as subtask_project_names,
|
||||
COALESCE(td.auto_complete, FALSE) as auto_complete,
|
||||
td.progression_value as draft_progression_value
|
||||
td.progression_value as draft_progression_value,
|
||||
CASE WHEN td.id IS NOT NULL THEN (SELECT COUNT(*) FROM task_draft_subtasks tds WHERE tds.task_draft_id = td.id) ELSE NULL END as draft_subtasks_count
|
||||
FROM tasks t
|
||||
LEFT JOIN task_drafts td ON td.task_id = t.id AND td.user_id = $1
|
||||
WHERE t.user_id = $1 AND t.parent_task_id IS NULL AND t.deleted = FALSE
|
||||
@@ -8533,6 +8535,7 @@ func (a *App) fetchTasksForUser(userID int) ([]Task, error) {
|
||||
var subtaskProjectNames pq.StringArray
|
||||
var autoComplete bool
|
||||
var draftProgressionValue sql.NullFloat64
|
||||
var draftSubtasksCount sql.NullInt64
|
||||
|
||||
err := rows.Scan(
|
||||
&task.ID,
|
||||
@@ -8553,6 +8556,7 @@ func (a *App) fetchTasksForUser(userID int) ([]Task, error) {
|
||||
&subtaskProjectNames,
|
||||
&autoComplete,
|
||||
&draftProgressionValue,
|
||||
&draftSubtasksCount,
|
||||
)
|
||||
if err != nil {
|
||||
log.Printf("Error scanning task: %v", err)
|
||||
@@ -8600,6 +8604,10 @@ func (a *App) fetchTasksForUser(userID int) ([]Task, error) {
|
||||
if draftProgressionValue.Valid {
|
||||
task.DraftProgressionValue = &draftProgressionValue.Float64
|
||||
}
|
||||
if draftSubtasksCount.Valid {
|
||||
count := int(draftSubtasksCount.Int64)
|
||||
task.DraftSubtasksCount = &count
|
||||
}
|
||||
|
||||
// Объединяем проекты из основной задачи и подзадач
|
||||
allProjects := make(map[string]bool)
|
||||
|
||||
Reference in New Issue
Block a user