feat: add 'not_started' task status with updates to task creation, status handling, and translations
This commit is contained in:
@@ -844,15 +844,14 @@ export default function ProjectTasksSection({ projectId }) {
|
|||||||
className="w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
className="w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
||||||
>
|
>
|
||||||
<option value="">{t("common.selectOption")}</option>
|
<option value="">{t("common.selectOption")}</option>
|
||||||
|
<option value="not_started">{t("taskStatus.not_started")}</option>
|
||||||
<option value="pending">{t("taskStatus.pending")}</option>
|
<option value="pending">{t("taskStatus.pending")}</option>
|
||||||
<option value="in_progress">{t("taskStatus.in_progress")}</option>
|
<option value="in_progress">{t("taskStatus.in_progress")}</option>
|
||||||
<option value="completed">{t("taskStatus.completed")}</option>
|
<option value="completed">{t("taskStatus.completed")}</option>
|
||||||
<option value="cancelled">{t("taskStatus.cancelled")}</option>
|
<option value="cancelled">{t("taskStatus.cancelled")}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> <div className="flex items-center justify-end gap-3 mt-6">
|
||||||
|
|
||||||
<div className="flex items-center justify-end gap-3 mt-6">
|
|
||||||
<Button variant="outline" onClick={handleCloseEditModal}>
|
<Button variant="outline" onClick={handleCloseEditModal}>
|
||||||
{t("common.cancel")}
|
{t("common.cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -280,16 +280,18 @@ export default function initializeDatabase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Migration: Update task status system - add 'not_started' status
|
// Migration: Update task status system - add 'not_started' status
|
||||||
try {
|
// DISABLED: This migration was running on every init and converting legitimate
|
||||||
// First, update all existing 'pending' tasks to 'not_started'
|
// 'pending' tasks back to 'not_started'. The initial migration has been completed.
|
||||||
db.exec(`
|
// try {
|
||||||
UPDATE project_tasks SET status = 'not_started' WHERE status = 'pending';
|
// // First, update all existing 'pending' tasks to 'not_started'
|
||||||
`);
|
// db.exec(`
|
||||||
// Note: CHECK constraint will be applied when recreating the table in future migrations
|
// UPDATE project_tasks SET status = 'not_started' WHERE status = 'pending';
|
||||||
// For now, we'll rely on application-level validation
|
// `);
|
||||||
} catch (e) {
|
// // Note: CHECK constraint will be applied when recreating the table in future migrations
|
||||||
// Migration already done, ignore error
|
// // For now, we'll rely on application-level validation
|
||||||
}
|
// } catch (e) {
|
||||||
|
// // Migration already done, ignore error
|
||||||
|
// }
|
||||||
|
|
||||||
// Create indexes for notes user tracking
|
// Create indexes for notes user tracking
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ export function createProjectTask(data) {
|
|||||||
if (result.lastInsertRowid) {
|
if (result.lastInsertRowid) {
|
||||||
const language = getUserLanguage();
|
const language = getUserLanguage();
|
||||||
const priority = data.priority || "normal";
|
const priority = data.priority || "normal";
|
||||||
const status = data.status || "pending";
|
const status = data.status || "not_started";
|
||||||
const translatedPriority = translatePriority(priority, language);
|
const translatedPriority = translatePriority(priority, language);
|
||||||
const translatedStatus = translateStatus(status, language);
|
const translatedStatus = translateStatus(status, language);
|
||||||
const logMessage = `${serverT("Task created", language)} "${taskName}" ${serverT("with priority", language)}: ${translatedPriority}, ${serverT("status", language)}: ${translatedStatus}`;
|
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 stmt;
|
||||||
let result;
|
let result;
|
||||||
|
|
||||||
if (oldStatus === "pending" && status === "in_progress") {
|
if ((oldStatus === "not_started" || oldStatus === "pending") && status === "in_progress") {
|
||||||
// Starting a task - set date_started
|
// Starting a task - set date_started
|
||||||
stmt = db.prepare(`
|
stmt = db.prepare(`
|
||||||
UPDATE project_tasks
|
UPDATE project_tasks
|
||||||
@@ -334,7 +334,7 @@ export function updateProjectTask(taskId, updates, userId = null) {
|
|||||||
values.push(updates.status);
|
values.push(updates.status);
|
||||||
|
|
||||||
// Handle status-specific timestamp updates
|
// 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')");
|
fields.push("date_started = datetime('now', 'localtime')");
|
||||||
} else if (updates.status === "completed") {
|
} else if (updates.status === "completed") {
|
||||||
fields.push("date_completed = datetime('now', 'localtime')");
|
fields.push("date_completed = datetime('now', 'localtime')");
|
||||||
@@ -587,7 +587,7 @@ export function applyTaskSetToProject(setId, projectId, userId = null) {
|
|||||||
const result = createProjectTask({
|
const result = createProjectTask({
|
||||||
project_id: projectId,
|
project_id: projectId,
|
||||||
task_template_id: template.task_id,
|
task_template_id: template.task_id,
|
||||||
status: "pending",
|
status: "not_started",
|
||||||
priority: "normal",
|
priority: "normal",
|
||||||
created_by: userId,
|
created_by: userId,
|
||||||
assigned_to: null, // Will be assigned based on user role logic in createProjectTask
|
assigned_to: null, // Will be assigned based on user role logic in createProjectTask
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const serverTranslations = {
|
|||||||
"with priority": "z priorytetem",
|
"with priority": "z priorytetem",
|
||||||
"status": "status",
|
"status": "status",
|
||||||
"Project cancelled on": "Projekt został wycofany w dniu",
|
"Project cancelled on": "Projekt został wycofany w dniu",
|
||||||
|
"not_started": "nie rozpoczęte",
|
||||||
"pending": "oczekujące",
|
"pending": "oczekujące",
|
||||||
"in_progress": "w trakcie",
|
"in_progress": "w trakcie",
|
||||||
"completed": "ukończone",
|
"completed": "ukończone",
|
||||||
@@ -39,6 +40,7 @@ const serverTranslations = {
|
|||||||
"with priority": "with priority",
|
"with priority": "with priority",
|
||||||
"status": "status",
|
"status": "status",
|
||||||
"Project cancelled on": "Project cancelled on",
|
"Project cancelled on": "Project cancelled on",
|
||||||
|
"not_started": "not started",
|
||||||
"pending": "pending",
|
"pending": "pending",
|
||||||
"in_progress": "in_progress",
|
"in_progress": "in_progress",
|
||||||
"completed": "completed",
|
"completed": "completed",
|
||||||
|
|||||||
Reference in New Issue
Block a user