Skip to content

Commit

Permalink
hotfix(backend): Fix month credit calculation on December (#8851)
Browse files Browse the repository at this point in the history
  • Loading branch information
majdyz committed Dec 2, 2024
1 parent d26105d commit 0c29403
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion autogpt_platform/backend/backend/data/credit.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ class UserCredit(UserCreditBase):
async def get_or_refill_credit(self, user_id: str) -> int:
cur_time = self.time_now()
cur_month = cur_time.replace(day=1, hour=0, minute=0, second=0, microsecond=0)
nxt_month = cur_month.replace(month=cur_month.month % 12 + 1)
nxt_month = (
cur_month.replace(month=cur_month.month + 1)
if cur_month.month < 12
else cur_month.replace(year=cur_month.year + 1, month=1)
)

user_credit = await UserBlockCredit.prisma().group_by(
by=["userId"],
Expand Down

0 comments on commit 0c29403

Please sign in to comment.