Skip to content

Commit

Permalink
Merge pull request #12 from telling-me/fix/mission
Browse files Browse the repository at this point in the history
fix: 미션 검증 로직 6시 기준으로 수정
  • Loading branch information
taewoo-dev authored Dec 22, 2024
2 parents 1bb0107 + 91b09e9 commit ab6f6a4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/v2/missions/services/mission_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from datetime import date, datetime, timedelta, timezone
from typing import Optional

import pytz
from fastapi import HTTPException
from tortoise.exceptions import DoesNotExist
from tortoise.transactions import atomic
Expand Down Expand Up @@ -200,11 +201,15 @@ async def check_three_likes_different_posts(user_id: str) -> bool:

@staticmethod
async def check_daily_post(user_id: str) -> bool:
answer = await AnswerService.get_most_recent_answer(user_id=user_id)
seoul_tz = pytz.timezone("Asia/Seoul")
now = datetime.now(seoul_tz)

current_date = (now - timedelta(days=1)).date() if now.hour < 6 else now.date()

answer = await AnswerService.get_most_recent_answer(user_id=user_id)
answer_date = answer.get("date")

return answer_date == date.today() # type: ignore
return answer_date == current_date # type: ignore

@staticmethod
async def validate_reward(reward_code: str): # type: ignore
Expand Down

0 comments on commit ab6f6a4

Please sign in to comment.