add abandoned status to distinguish given-up habits from completed ones
Completed and abandoned habits were both lumped under a single terminal state, making it impossible to tell "finished successfully" apart from "gave up" when reviewing habit history.
This commit is contained in:
@@ -18,6 +18,7 @@ class HabitType(str, enum.Enum):
|
||||
class HabitStatus(str, enum.Enum):
|
||||
ACTIVE = "active"
|
||||
COMPLETED = "completed"
|
||||
ABANDONED = "abandoned"
|
||||
|
||||
|
||||
class Habit(Base):
|
||||
@@ -38,6 +39,7 @@ class Habit(Base):
|
||||
sort_order: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(server_default=func.now(), nullable=False)
|
||||
completed_at: Mapped[datetime | None] = mapped_column(nullable=True)
|
||||
abandoned_at: Mapped[datetime | None] = mapped_column(nullable=True)
|
||||
|
||||
logs: Mapped[list["HabitLog"]] = relationship(
|
||||
back_populates="habit", cascade="all, delete-orphan", passive_deletes=True
|
||||
|
||||
Reference in New Issue
Block a user