feat: add 'not_started' task status with updates to task creation, status handling, and translations
This commit is contained in:
@@ -280,16 +280,18 @@ export default function initializeDatabase() {
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
// DISABLED: This migration was running on every init and converting legitimate
|
||||
// 'pending' tasks back to 'not_started'. The initial migration has been completed.
|
||||
// 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 {
|
||||
|
||||
@@ -127,7 +127,7 @@ export function createProjectTask(data) {
|
||||
if (result.lastInsertRowid) {
|
||||
const language = getUserLanguage();
|
||||
const priority = data.priority || "normal";
|
||||
const status = data.status || "pending";
|
||||
const status = data.status || "not_started";
|
||||
const translatedPriority = translatePriority(priority, language);
|
||||
const translatedStatus = translateStatus(status, language);
|
||||
const logMessage = `${serverT("Task created", language)} "${taskName}" ${serverT("with priority", language)}: ${translatedPriority}, ${serverT("status", language)}: ${translatedStatus}`;
|
||||
@@ -158,7 +158,7 @@ export function updateProjectTaskStatus(taskId, status, userId = null) {
|
||||
let stmt;
|
||||
let result;
|
||||
|
||||
if (oldStatus === "pending" && status === "in_progress") {
|
||||
if ((oldStatus === "not_started" || oldStatus === "pending") && status === "in_progress") {
|
||||
// Starting a task - set date_started
|
||||
stmt = db.prepare(`
|
||||
UPDATE project_tasks
|
||||
@@ -334,7 +334,7 @@ export function updateProjectTask(taskId, updates, userId = null) {
|
||||
values.push(updates.status);
|
||||
|
||||
// Handle status-specific timestamp updates
|
||||
if (currentTask.status === "pending" && updates.status === "in_progress") {
|
||||
if ((currentTask.status === "not_started" || currentTask.status === "pending") && updates.status === "in_progress") {
|
||||
fields.push("date_started = datetime('now', 'localtime')");
|
||||
} else if (updates.status === "completed") {
|
||||
fields.push("date_completed = datetime('now', 'localtime')");
|
||||
@@ -587,7 +587,7 @@ export function applyTaskSetToProject(setId, projectId, userId = null) {
|
||||
const result = createProjectTask({
|
||||
project_id: projectId,
|
||||
task_template_id: template.task_id,
|
||||
status: "pending",
|
||||
status: "not_started",
|
||||
priority: "normal",
|
||||
created_by: userId,
|
||||
assigned_to: null, // Will be assigned based on user role logic in createProjectTask
|
||||
|
||||
@@ -15,6 +15,7 @@ const serverTranslations = {
|
||||
"with priority": "z priorytetem",
|
||||
"status": "status",
|
||||
"Project cancelled on": "Projekt został wycofany w dniu",
|
||||
"not_started": "nie rozpoczęte",
|
||||
"pending": "oczekujące",
|
||||
"in_progress": "w trakcie",
|
||||
"completed": "ukończone",
|
||||
@@ -39,6 +40,7 @@ const serverTranslations = {
|
||||
"with priority": "with priority",
|
||||
"status": "status",
|
||||
"Project cancelled on": "Project cancelled on",
|
||||
"not_started": "not started",
|
||||
"pending": "pending",
|
||||
"in_progress": "in_progress",
|
||||
"completed": "completed",
|
||||
|
||||
Reference in New Issue
Block a user