Skip to content

Commit d6536df

Browse files
committed
Merge branch 'main' of github.com:Rustix69/CCSync into feat/percentage-tracker-filter
2 parents 57548b1 + 28e2825 commit d6536df

17 files changed

Lines changed: 1350 additions & 126 deletions

File tree

backend/controllers/edit_task.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ func EditTaskHandler(w http.ResponseWriter, r *http.Request) {
4949
start := requestBody.Start
5050
entry := requestBody.Entry
5151
wait := requestBody.Wait
52+
end := requestBody.End
53+
depends := requestBody.Depends
5254

5355
if taskID == "" {
5456
http.Error(w, "taskID is required", http.StatusBadRequest)
@@ -60,7 +62,7 @@ func EditTaskHandler(w http.ResponseWriter, r *http.Request) {
6062
Name: "Edit Task",
6163
Execute: func() error {
6264
logStore.AddLog("INFO", fmt.Sprintf("Editing task ID: %s", taskID), uuid, "Edit Task")
63-
err := tw.EditTaskInTaskwarrior(uuid, description, email, encryptionSecret, taskID, tags, project, start, entry, wait)
65+
err := tw.EditTaskInTaskwarrior(uuid, description, email, encryptionSecret, taskID, tags, project, start, entry, wait, end, depends)
6466
if err != nil {
6567
logStore.AddLog("ERROR", fmt.Sprintf("Failed to edit task ID %s: %v", taskID, err), uuid, "Edit Task")
6668
return err

backend/models/request_body.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ type EditTaskRequestBody struct {
3434
Start string `json:"start"`
3535
Entry string `json:"entry"`
3636
Wait string `json:"wait"`
37+
End string `json:"end"`
38+
Depends []string `json:"depends"`
3739
}
3840
type CompleteTaskRequestBody struct {
3941
Email string `json:"email"`

backend/utils/tw/edit_task.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strings"
88
)
99

10-
func EditTaskInTaskwarrior(uuid, description, email, encryptionSecret, taskID string, tags []string, project string, start string, entry string, wait string) error {
10+
func EditTaskInTaskwarrior(uuid, description, email, encryptionSecret, taskID string, tags []string, project string, start string, entry string, wait string, end string, depends []string) error {
1111
if err := utils.ExecCommand("rm", "-rf", "/root/.task"); err != nil {
1212
return fmt.Errorf("error deleting Taskwarrior data: %v", err)
1313
}
@@ -87,6 +87,21 @@ func EditTaskInTaskwarrior(uuid, description, email, encryptionSecret, taskID st
8787
}
8888
}
8989

90+
// Handle end date
91+
if end != "" {
92+
if err := utils.ExecCommand("task", taskID, "modify", "end:"+end); err != nil {
93+
return fmt.Errorf("failed to set end date %s: %v", end, err)
94+
}
95+
}
96+
97+
// Handle depends
98+
if len(depends) > 0 {
99+
dependsStr := strings.Join(depends, ",")
100+
if err := utils.ExecCommand("task", taskID, "modify", "depends:"+dependsStr); err != nil {
101+
return fmt.Errorf("failed to set depends %s: %v", dependsStr, err)
102+
}
103+
}
104+
90105
// Sync Taskwarrior again
91106
if err := SyncTaskwarrior(tempDir); err != nil {
92107
return err

backend/utils/tw/taskwarrior_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestSyncTaskwarrior(t *testing.T) {
2323
}
2424

2525
func TestEditTaskInATaskwarrior(t *testing.T) {
26-
err := EditTaskInTaskwarrior("uuid", "description", "email", "encryptionSecret", "taskuuid", nil, "project", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z")
26+
err := EditTaskInTaskwarrior("uuid", "description", "email", "encryptionSecret", "taskuuid", nil, "project", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z", "2025-11-30T18:30:00.000Z", nil)
2727
if err != nil {
2828
t.Errorf("EditTaskInTaskwarrior() failed: %v", err)
2929
} else {
@@ -68,7 +68,7 @@ func TestAddTaskWithTags(t *testing.T) {
6868
}
6969

7070
func TestEditTaskWithTagAddition(t *testing.T) {
71-
err := EditTaskInTaskwarrior("uuid", "description", "email", "encryptionSecret", "taskuuid", []string{"+urgent", "+important"}, "project", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z")
71+
err := EditTaskInTaskwarrior("uuid", "description", "email", "encryptionSecret", "taskuuid", []string{"+urgent", "+important"}, "project", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z", "2025-11-30T18:30:00.000Z", nil)
7272
if err != nil {
7373
t.Errorf("EditTaskInTaskwarrior with tag addition failed: %v", err)
7474
} else {
@@ -77,7 +77,7 @@ func TestEditTaskWithTagAddition(t *testing.T) {
7777
}
7878

7979
func TestEditTaskWithTagRemoval(t *testing.T) {
80-
err := EditTaskInTaskwarrior("uuid", "description", "email", "encryptionSecret", "taskuuid", []string{"-work", "-lowpriority"}, "project", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z")
80+
err := EditTaskInTaskwarrior("uuid", "description", "email", "encryptionSecret", "taskuuid", []string{"-work", "-lowpriority"}, "project", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z", "2025-11-30T18:30:00.000Z", nil)
8181
if err != nil {
8282
t.Errorf("EditTaskInTaskwarrior with tag removal failed: %v", err)
8383
} else {
@@ -86,7 +86,7 @@ func TestEditTaskWithTagRemoval(t *testing.T) {
8686
}
8787

8888
func TestEditTaskWithMixedTagOperations(t *testing.T) {
89-
err := EditTaskInTaskwarrior("uuid", "description", "email", "encryptionSecret", "taskuuid", []string{"+urgent", "-work", "normal"}, "project", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z")
89+
err := EditTaskInTaskwarrior("uuid", "description", "email", "encryptionSecret", "taskuuid", []string{"+urgent", "-work", "normal"}, "project", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z", "2025-11-29T18:30:00.000Z", "2025-11-30T18:30:00.000Z", nil)
9090
if err != nil {
9191
t.Errorf("EditTaskInTaskwarrior with mixed tag operations failed: %v", err)
9292
} else {

frontend/package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
"framer-motion": "^11.3.8",
130130
"fs.realpath": "^1.0.0",
131131
"function-bind": "^1.1.2",
132+
"fuse.js": "^7.1.0",
132133
"gensync": "^1.0.0-beta.2",
133134
"get-caller-file": "^2.0.5",
134135
"get-nonce": "^1.0.1",

frontend/src/components/HomeComponents/Navbar/NavbarDesktop.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import { url } from '@/components/utils/URLs';
3838
import { exportTasksAsJSON, exportTasksAsTXT } from '@/exports-tasks';
3939
import { useState } from 'react';
4040
import { DevLogs } from '../DevLogs/DevLogs';
41-
import { useTaskAutoSync } from '@/Task-AutoSync';
41+
import { useTaskAutoSync } from '@/components/utils/Task-AutoSync';
4242
import { Label } from '@/components/ui/label';
4343

4444
export const NavbarDesktop = (

frontend/src/components/HomeComponents/Navbar/NavbarMobile.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import {
3737
import { Button } from '@/components/ui/button';
3838
import { exportTasksAsJSON, exportTasksAsTXT } from '@/exports-tasks';
3939
import { DevLogs } from '../DevLogs/DevLogs';
40-
import { useTaskAutoSync } from '@/Task-AutoSync';
40+
import { useTaskAutoSync } from '@/components/utils/Task-AutoSync';
4141
import { Label } from '@/components/ui/label';
4242
import { Switch } from '@/components/ui/switch';
4343
import { Slider } from '@/components/ui/slider';

frontend/src/components/HomeComponents/SetupGuide/SetupGuide.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Button } from '@/components/ui/button';
66

77
export const SetupGuide = (props: Props) => {
88
const downloadConfigFile = () => {
9-
const configContent = exportConfigSetup(props); // already a string
9+
const configContent = exportConfigSetup(props);
1010
const blob = new Blob([configContent], {
1111
type: 'text/plain;charset=utf-8',
1212
});

0 commit comments

Comments
 (0)