6.27.3: Фикс сброса автовыполнения и прогресс
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m28s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m28s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -353,6 +353,7 @@ type Task struct {
|
||||
HasProgression bool `json:"has_progression"`
|
||||
AutoComplete bool `json:"auto_complete"`
|
||||
DefaultAutoComplete bool `json:"default_auto_complete"`
|
||||
HasDraft bool `json:"has_draft"`
|
||||
DefaultProgress *float64 `json:"default_progress,omitempty"`
|
||||
DraftProgressionValue *float64 `json:"draft_progression_value,omitempty"`
|
||||
DraftSubtasksCount *int `json:"draft_subtasks_count,omitempty"`
|
||||
@@ -396,6 +397,7 @@ type TaskDetail struct {
|
||||
DictionaryIDs []int `json:"dictionary_ids,omitempty"`
|
||||
PurchaseBoards []PurchaseBoardInfo `json:"purchase_boards,omitempty"`
|
||||
// Draft fields (only present if draft exists)
|
||||
HasDraft bool `json:"has_draft"`
|
||||
DraftProgressionValue *float64 `json:"draft_progression_value,omitempty"`
|
||||
DraftSubtasks []DraftSubtask `json:"draft_subtasks,omitempty"`
|
||||
}
|
||||
@@ -8822,7 +8824,8 @@ func (a *App) fetchTasksForUser(userID int) ([]Task, error) {
|
||||
) as subtask_project_names,
|
||||
COALESCE(td.auto_complete, FALSE) as auto_complete,
|
||||
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
|
||||
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,
|
||||
CASE WHEN td.id IS NOT NULL THEN TRUE ELSE FALSE END as has_draft
|
||||
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
|
||||
@@ -8866,6 +8869,7 @@ func (a *App) fetchTasksForUser(userID int) ([]Task, error) {
|
||||
var autoComplete bool
|
||||
var draftProgressionValue sql.NullFloat64
|
||||
var draftSubtasksCount sql.NullInt64
|
||||
var hasDraft bool
|
||||
|
||||
err := rows.Scan(
|
||||
&task.ID,
|
||||
@@ -8889,6 +8893,7 @@ func (a *App) fetchTasksForUser(userID int) ([]Task, error) {
|
||||
&autoComplete,
|
||||
&draftProgressionValue,
|
||||
&draftSubtasksCount,
|
||||
&hasDraft,
|
||||
)
|
||||
if err != nil {
|
||||
log.Printf("Error scanning task: %v", err)
|
||||
@@ -8937,6 +8942,7 @@ func (a *App) fetchTasksForUser(userID int) ([]Task, error) {
|
||||
task.GroupName = &groupNameVal
|
||||
}
|
||||
task.AutoComplete = autoComplete
|
||||
task.HasDraft = hasDraft
|
||||
if draftProgressionValue.Valid {
|
||||
task.DraftProgressionValue = &draftProgressionValue.Float64
|
||||
}
|
||||
@@ -9253,8 +9259,10 @@ func (a *App) getTaskDetailHandler(w http.ResponseWriter, r *http.Request) {
|
||||
WHERE task_id = $1 AND user_id = $2
|
||||
`, taskID, userID).Scan(&draftProgressionValue, &draftAutoComplete)
|
||||
|
||||
hasDraft := false
|
||||
if err == nil {
|
||||
// Драфт существует, загружаем данные
|
||||
hasDraft = true
|
||||
if draftProgressionValue.Valid {
|
||||
draftProgressionValuePtr = &draftProgressionValue.Float64
|
||||
}
|
||||
@@ -9307,6 +9315,7 @@ func (a *App) getTaskDetailHandler(w http.ResponseWriter, r *http.Request) {
|
||||
Task: task,
|
||||
Rewards: rewards,
|
||||
Subtasks: subtasks,
|
||||
HasDraft: hasDraft,
|
||||
}
|
||||
|
||||
// Устанавливаем DraftProgressionValue если он был загружен
|
||||
|
||||
Reference in New Issue
Block a user