2026-05-08 12:42:50 +08:00

3.4 KiB

Task Table:

  • task_id: primary key
  • title: str (required, non-empty)
  • desc: str (optional, can be empty)
  • status: enum{todo, doing, pending, done}
  • goal_id: foreign key to goal table (required, each task belongs to exactly one goal)
  • start_time: timestamp or None
  • finished_time: timestamp or None
  • order: float (for ordering unfinished tasks)

Goal Table:

  • goal_id: primary key
  • title: str (required, non-empty)
  • activated: bool (deactivated goals and their tasks are hidden from Task Page GUI)

User Table:

  • user_id: primary key
  • username: str (unique, required)
  • password_hash: str (required)
  • role: enum{user, admin} (admin can configure goal limits)
  • max_goals: int (maximum goals this user can create, configurable by admin)

GUI:

Page 1. Goal CRUD

  • List all goals with activate/deactivate toggle
  • Create, edit, delete goals
  • Shows goal title and activation status

Page 2. Task CRUD

  • Tasks are grouped by their parent goal
  • Only activated goals and their tasks are visible
  • Focus Rule: Each goal highlights its single "doing" task prominently
  • Scroll View: Tasks displayed in a scrollable selector (like time picker widget)
    • Center/focus area shows current task
    • Unfinished tasks ordered by order field
    • Finished tasks ordered by finished_time (most recent first)
    • Drag-and-drop reordering for unfinished tasks
  • Side Panel: Clicking a task opens a side panel for editing task details
  • Task status transitions:
    • User manually switches task to "doing" (only one per goal)
    • When "doing" task is completed, status becomes "done" (no auto-promotion)
    • User must manually set next task to "doing"

Constraints:

  1. Focus Rule: Under each goal, there should be only one "doing" task. The GUI must visually emphasize the "doing" task for each goal.

  2. Ordering Rule:

    • Finished tasks are ordered by finished_time (descending)
    • Unfinished tasks are ordered by order field (ascending)
    • Users can reorder unfinished tasks via drag-and-drop
  3. Scroll View: Tasks are displayed in a linear scroll view selector (similar to HH:mm time picker). The current task is centered/focused. Users can drag-and-drop to reorder future tasks.

  4. Task-Good Relationship: Tasks cannot exist without a goal. Each task belongs to exactly one goal.

  5. Goal Limit: Each user can only create up to their max_goals limit. Admin can modify this limit per user.

  6. Visibility: Deactivated goals and all their tasks are hidden from the Task Page.

Business Rules:

  • Task title is required and cannot be empty
  • Goal title is required and cannot be empty
  • Tasks can be deleted (order values don't need to be continuous)
  • Goals can be activated/deactivated (only affects GUI visibility)
  • Only one "doing" task per goal at any time
  • Users must manually set a task to "doing" status
  • Simple user registration with username/password

Tech Stack:

  • Backend: Python + Flask (lightweight, good for small apps)
  • Frontend: Vanilla JS + HTML/CSS (simple, no build step needed)
  • Database: TinyDB (single JSON file, perfect for this scale)
  • Authentication: Session-based with password hashing (bcrypt)
  • Drag-and-drop: HTML5 Drag and Drop API or SortableJS

Multi-User Features:

  • User registration and login
  • Each user has isolated goals and tasks
  • Admin user can:
    • Configure max_goals_per_user limit
    • View all users (optional)
  • Regular users can only see/manage their own data