diff --git a/VERSION b/VERSION index 62d3df0..1980a78 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.16.5 +6.17.0 diff --git a/play-life-backend/main.go b/play-life-backend/main.go index 672d7fb..6eab73f 100644 --- a/play-life-backend/main.go +++ b/play-life-backend/main.go @@ -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) diff --git a/play-life-web/package.json b/play-life-web/package.json index 155188b..5e2f552 100644 --- a/play-life-web/package.json +++ b/play-life-web/package.json @@ -1,6 +1,6 @@ { "name": "play-life-web", - "version": "6.16.5", + "version": "6.17.0", "type": "module", "scripts": { "dev": "vite", diff --git a/play-life-web/src/components/TaskForm.jsx b/play-life-web/src/components/TaskForm.jsx index ef6ff87..11bcd25 100644 --- a/play-life-web/src/components/TaskForm.jsx +++ b/play-life-web/src/components/TaskForm.jsx @@ -391,7 +391,7 @@ function TaskForm({ onNavigate, taskId, wishlistId, returnTo, returnWishlistId } if (data.task.reward_policy) { setRewardPolicy(data.task.reward_policy) } else { - setRewardPolicy('personal') // Значение по умолчанию + setRewardPolicy('general') // Значение по умолчанию } } else { setCurrentWishlistId(null) diff --git a/play-life-web/src/components/TaskList.jsx b/play-life-web/src/components/TaskList.jsx index 0a86b4a..909b338 100644 --- a/play-life-web/src/components/TaskList.jsx +++ b/play-life-web/src/components/TaskList.jsx @@ -924,7 +924,11 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
{task.name} {hasSubtasks && ( - (+{task.subtasks_count}) + + {task.draft_subtasks_count != null + ? `(${task.draft_subtasks_count}/${task.subtasks_count})` + : `(${task.subtasks_count})`} + )} {!isOneTime && !isInfinite && !isWishlist && (