fix: 마감일 없는 할일도 완료 여부와 상관없이 표시
- 마감일이 없는 할일은 특정 날짜에 속하지 않으므로 항상 표시 - 완료 체크 시 목록에서 사라지는 버그 수정
This commit is contained in:
@@ -40,7 +40,7 @@ router.get("/today", async (req, res) => {
|
||||
// Show todos that are:
|
||||
// 1. Due today (between start and end of today) - both completed and incomplete
|
||||
// 2. Due in the future (not yet due) - only incomplete
|
||||
// 3. Have no due date set - only incomplete
|
||||
// 3. Have no due date set - both completed and incomplete (always show)
|
||||
// Filter out: overdue todos (due date before today)
|
||||
const todos = await Todo.find({
|
||||
$or: [
|
||||
@@ -48,9 +48,9 @@ router.get("/today", async (req, res) => {
|
||||
{ dueDate: { $gte: start, $lte: end } },
|
||||
// Future todos - only incomplete
|
||||
{ dueDate: { $gt: end }, completed: false },
|
||||
// No due date - only incomplete
|
||||
{ dueDate: { $exists: false }, completed: false },
|
||||
{ dueDate: null, completed: false }
|
||||
// No due date - always show (completed or not)
|
||||
{ dueDate: { $exists: false } },
|
||||
{ dueDate: null }
|
||||
]
|
||||
}).sort({
|
||||
completed: 1, // Incomplete first
|
||||
|
||||
@@ -39,8 +39,8 @@ class TodoService {
|
||||
// Future date - only show if incomplete
|
||||
return !todo.completed;
|
||||
}
|
||||
// No due date - only show if incomplete
|
||||
return !todo.completed;
|
||||
// No due date - always show (completed or not)
|
||||
return true;
|
||||
}).toList();
|
||||
|
||||
// Sort: incomplete first, then by due date
|
||||
|
||||
Reference in New Issue
Block a user