feat: implement 'not_started' task status with validation and UI updates

This commit is contained in:
2025-10-07 23:07:15 +02:00
parent a6ef325813
commit 33c5466d77
6 changed files with 31 additions and 4 deletions

View File

@@ -135,6 +135,7 @@ const translations = {
// Task statuses
taskStatus: {
not_started: "Nie rozpoczęte",
pending: "Oczekujące",
in_progress: "W trakcie",
completed: "Ukończone",
@@ -699,6 +700,7 @@ const translations = {
},
taskStatus: {
not_started: "Not Started",
pending: "Pending",
in_progress: "In Progress",
completed: "Completed",

View File

@@ -71,7 +71,7 @@ export default function initializeDatabase() {
task_template_id INTEGER,
custom_task_name TEXT,
custom_max_wait_days INTEGER DEFAULT 0,
status TEXT NOT NULL DEFAULT 'pending',
status TEXT NOT NULL DEFAULT 'not_started' CHECK(status IN ('not_started', 'pending', 'in_progress', 'completed', 'cancelled')),
date_added TEXT DEFAULT CURRENT_TIMESTAMP,
priority TEXT DEFAULT 'normal',
FOREIGN KEY (project_id) REFERENCES projects(project_id),
@@ -279,6 +279,18 @@ export default function initializeDatabase() {
// Column already exists, ignore error
}
// Migration: Update task status system - add 'not_started' status
try {
// First, update all existing 'pending' tasks to 'not_started'
db.exec(`
UPDATE project_tasks SET status = 'not_started' WHERE status = 'pending';
`);
// Note: CHECK constraint will be applied when recreating the table in future migrations
// For now, we'll rely on application-level validation
} catch (e) {
// Migration already done, ignore error
}
// Create indexes for notes user tracking
try {
db.exec(`

View File

@@ -90,7 +90,7 @@ export function createProjectTask(data) {
result = stmt.run(
data.project_id,
data.task_template_id,
data.status || "pending",
data.status || "not_started",
data.priority || "normal",
data.created_by || null,
data.assigned_to || null
@@ -114,7 +114,7 @@ export function createProjectTask(data) {
data.custom_task_name,
data.custom_max_wait_days || 0,
data.custom_description || "",
data.status || "pending",
data.status || "not_started",
data.priority || "normal",
data.created_by || null,
data.assigned_to || null