fix - updating team

This commit is contained in:
Ishaan Jaff 2024-05-25 15:31:25 -07:00
parent 61bc6fae63
commit 8efa76f1a4
3 changed files with 34 additions and 5 deletions

View file

@ -8121,16 +8121,16 @@ async def update_team(
detail={"error": f"Team not found, passed team_id={data.team_id}"},
)
updated_kv = data.json(exclude_none=True)
# Check budget_duration and budget_reset_at
if data.budget_duration is not None:
duration_s = _duration_in_seconds(duration=data.budget_duration)
reset_at = datetime.now(timezone.utc) + timedelta(seconds=duration_s)
# set the budget duration and budget_reset_at in DB
data.budget_duration = duration_s
data.budget_reset_at = reset_at
# set the budget_reset_at in DB
updated_kv["budget_reset_at"] = reset_at
updated_kv = data.json(exclude_none=True)
team_row = await prisma_client.update_data(
update_key_values=updated_kv,
data=updated_kv,