feat(project):add delay date

This commit is contained in:
shahzeydyfah
2025-06-06 12:48:56 +03:30
parent bf81fdf0b8
commit 5cb200b8a8
+7 -4
View File
@@ -1,9 +1,9 @@
import datetime
import json
import uuid
from uuid import UUID
import requests
from dateutil.relativedelta import relativedelta
from fastapi import HTTPException
from app.config import TaskEnv
@@ -64,9 +64,12 @@ class ProjectRepository(BaseRepository[ProjectModel]):
coding.has_monitor = True
await self.create_report_price(coding)
if coding.monitor.detail.date_create_project and coding.monitor.detail.first_time:
date_create = coding.monitor.detail.date_create_project
months = int(coding.monitor.detail.first_time)
coding.date_delay = date_create + relativedelta(months=months)
start_date = coding.monitor.detail.date_create_project
first_time_months = int(coding.monitor.detail.first_time)
new_month = start_date.month + first_time_months
new_year = start_date.year + (new_month - 1) // 12
new_month = (new_month - 1) % 12 + 1
coding.date_delay = start_date.replace(year=new_year, month=new_month)
else:
coding.has_monitor = False