[fix] solution/backend: 미니블로그 승인 메일은 그날 배정된 글만 — 밀린 글이 오늘 글 대신 나가던 것
승인 알림보내기·아침 9시 발송이 배정일 오늘 이전 글 중 가장 오래된 것을 골라, 10/1 에 9/23 글이 메일로 갔다. - post_crud: due_for_mail · next_due_for_mail 를 scheduled_date == today 로 테스트 1건 추가. 블로그 70 passed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
368762d453
commit
1bf2ed0fd2
2 files changed
+32
-4
No files matched your search
@@ -42,12 +42,12 @@ class PostCRUD:
|
||||
return result.scalar()
|
||||
|
||||
async def due_for_mail(self, cdb: AsyncSession, status: int, today, limit: int):
|
||||
"""배정일이 오늘까지 온 것 중 업장당 1건만, 이른 날짜순."""
|
||||
"""배정일이 오늘인 것만, 업장당 1건."""
|
||||
result = await cdb.execute(
|
||||
select(place_posts)
|
||||
.where(
|
||||
place_posts.status == status, place_posts.deleted == False, # noqa: E712
|
||||
place_posts.scheduled_date <= today,
|
||||
place_posts.scheduled_date == today,
|
||||
)
|
||||
.distinct(place_posts.place_id)
|
||||
.order_by(place_posts.place_id, place_posts.scheduled_date)
|
||||
@@ -62,9 +62,9 @@ class PostCRUD:
|
||||
.where(
|
||||
place_posts.place_id == place_id, place_posts.status == status,
|
||||
place_posts.deleted == False, # noqa: E712
|
||||
place_posts.scheduled_date <= today,
|
||||
place_posts.scheduled_date == today,
|
||||
)
|
||||
.order_by(place_posts.scheduled_date)
|
||||
.order_by(place_posts.created_at)
|
||||
.limit(1)
|
||||
)
|
||||
return result.scalars().first()
|
||||
|
||||
Reference in new issue
Block a user