|
@@ -58,7 +58,7 @@ type TaskShelf interface {
|
|
// delete an existing task from the shelf
|
|
// delete an existing task from the shelf
|
|
DeleteTask(id int)
|
|
DeleteTask(id int)
|
|
// Mark a task as complete
|
|
// Mark a task as complete
|
|
- MarkDone(id int)
|
|
|
|
|
|
+ MarkDone(id int) string
|
|
// hopefully you dont need to call this! ;)
|
|
// hopefully you dont need to call this! ;)
|
|
ResetDone(id int)
|
|
ResetDone(id int)
|
|
// Add a task to the shelf
|
|
// Add a task to the shelf
|
|
@@ -219,25 +219,26 @@ and write it, as opposed to just modifying the pointer and then writing.
|
|
:param id: the ID of the task to mark as done
|
|
:param id: the ID of the task to mark as done
|
|
:returns: Nothing
|
|
:returns: Nothing
|
|
*/
|
|
*/
|
|
-func (f *FilesystemShelf) MarkDone(id int) {
|
|
|
|
|
|
+func (f *FilesystemShelf) MarkDone(id int) string {
|
|
replTasks := []Task{}
|
|
replTasks := []Task{}
|
|
|
|
+ var taskName string
|
|
for i := range f.Tasks {
|
|
for i := range f.Tasks {
|
|
if f.Tasks[i].Id == id {
|
|
if f.Tasks[i].Id == id {
|
|
- doneTask := Task{
|
|
|
|
|
|
+ replTasks = append(replTasks, Task{
|
|
Id: f.Tasks[i].Id,
|
|
Id: f.Tasks[i].Id,
|
|
Title: f.Tasks[i].Title,
|
|
Title: f.Tasks[i].Title,
|
|
Desc: f.Tasks[i].Desc,
|
|
Desc: f.Tasks[i].Desc,
|
|
Due: f.Tasks[i].Due,
|
|
Due: f.Tasks[i].Due,
|
|
Done: true,
|
|
Done: true,
|
|
Priority: f.Tasks[i].Priority,
|
|
Priority: f.Tasks[i].Priority,
|
|
- }
|
|
|
|
- replTasks = append(replTasks, doneTask)
|
|
|
|
|
|
+ })
|
|
|
|
+ taskName = f.Tasks[i].Title
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
replTasks = append(replTasks, f.Tasks[i])
|
|
replTasks = append(replTasks, f.Tasks[i])
|
|
}
|
|
}
|
|
os.WriteFile(f.SaveLocation, marshalTaskToShelf(replTasks, f.Template), os.ModePerm)
|
|
os.WriteFile(f.SaveLocation, marshalTaskToShelf(replTasks, f.Template), os.ModePerm)
|
|
-
|
|
|
|
|
|
+ return taskName
|
|
}
|
|
}
|
|
|
|
|
|
func (f *FilesystemShelf) ResetDone(id int) {}
|
|
func (f *FilesystemShelf) ResetDone(id int) {}
|