feat: implement ProjectTasksList component and update ProjectTasksPage to use it
feat: add date_completed column to project_tasks table in database initialization feat: update project task status to set date_completed when marking as completed
This commit is contained in:
@@ -145,7 +145,6 @@ export default function initializeDatabase() {
|
||||
} catch (e) {
|
||||
// Column already exists, ignore error
|
||||
}
|
||||
|
||||
// Migration: Add is_system column to notes table
|
||||
try {
|
||||
db.exec(`
|
||||
@@ -154,4 +153,13 @@ export default function initializeDatabase() {
|
||||
} catch (e) {
|
||||
// Column already exists, ignore error
|
||||
}
|
||||
|
||||
// Migration: Add date_completed column to project_tasks table
|
||||
try {
|
||||
db.exec(`
|
||||
ALTER TABLE project_tasks ADD COLUMN date_completed TEXT;
|
||||
`);
|
||||
} catch (e) {
|
||||
// Column already exists, ignore error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ export function getAllProjectTasks() {
|
||||
p.project_name,
|
||||
p.wp,
|
||||
p.plot,
|
||||
p.city,
|
||||
p.address,
|
||||
p.finish_date
|
||||
FROM project_tasks pt
|
||||
LEFT JOIN tasks t ON pt.task_template_id = t.task_id
|
||||
@@ -138,8 +140,16 @@ export function updateProjectTaskStatus(taskId, status) {
|
||||
WHERE id = ?
|
||||
`);
|
||||
result = stmt.run(status, taskId);
|
||||
} else if (status === "completed") {
|
||||
// Completing a task - set date_completed
|
||||
stmt = db.prepare(`
|
||||
UPDATE project_tasks
|
||||
SET status = ?, date_completed = CURRENT_TIMESTAMP
|
||||
WHERE id = ?
|
||||
`);
|
||||
result = stmt.run(status, taskId);
|
||||
} else {
|
||||
// Just updating status without changing date_started
|
||||
// Just updating status without changing timestamps
|
||||
stmt = db.prepare(`
|
||||
UPDATE project_tasks
|
||||
SET status = ?
|
||||
|
||||
Reference in New Issue
Block a user