This commit is contained in:
Windpicker-owo
2025-08-31 20:56:35 +08:00
12 changed files with 174 additions and 164 deletions

View File

@@ -62,11 +62,10 @@ def get_active_plans_for_month(month: str) -> List[MonthlyPlan]:
"""
with get_db_session() as session:
try:
plans = (
session.query(MonthlyPlan)
.filter(MonthlyPlan.target_month == month, MonthlyPlan.status == "active")
.all()
)
plans = session.query(MonthlyPlan).filter(
MonthlyPlan.target_month == month,
MonthlyPlan.status == 'active'
).order_by(MonthlyPlan.created_at.desc()).all()
return plans
except Exception as e:
logger.error(f"查询 {month} 的有效月度计划时发生错误: {e}")

View File

@@ -51,6 +51,8 @@ class ChatStreams(Base):
user_id = Column(get_string_field(100), nullable=False, index=True)
user_nickname = Column(Text, nullable=False)
user_cardname = Column(Text, nullable=True)
energy_value = Column(Float, nullable=True, default=5.0)
sleep_pressure = Column(Float, nullable=True, default=0.0)
__table_args__ = (
Index("idx_chatstreams_stream_id", "stream_id"),