feat: 분석 페이지 고도화 및 AI 위험 적응형(AAS) SOI 모델 도입
This commit is contained in:
33
project_service.py
Normal file
33
project_service.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from sql_queries import DashboardQueries
|
||||
|
||||
class ProjectService:
|
||||
@staticmethod
|
||||
def get_available_dates_logic(cursor):
|
||||
cursor.execute(DashboardQueries.GET_AVAILABLE_DATES)
|
||||
rows = cursor.fetchall()
|
||||
return [row['crawl_date'].strftime("%Y.%m.%d") for row in rows if row['crawl_date']]
|
||||
|
||||
@staticmethod
|
||||
def get_project_data_logic(cursor, date_str):
|
||||
target_date = date_str.replace(".", "-") if date_str and date_str != "-" else None
|
||||
|
||||
if not target_date:
|
||||
cursor.execute(DashboardQueries.GET_LAST_CRAWL_DATE)
|
||||
res = cursor.fetchone()
|
||||
target_date = res['last_date']
|
||||
|
||||
if not target_date:
|
||||
return {"projects": []}
|
||||
|
||||
cursor.execute(DashboardQueries.GET_PROJECT_LIST, (target_date,))
|
||||
rows = cursor.fetchall()
|
||||
|
||||
projects = []
|
||||
for r in rows:
|
||||
name = r['short_nm'] if r['short_nm'] and r['short_nm'].strip() else r['project_nm']
|
||||
projects.append([
|
||||
name, r['department'], r['master'],
|
||||
r['recent_log'], r['file_count'],
|
||||
r['continent'], r['country']
|
||||
])
|
||||
return {"projects": projects}
|
||||
Reference in New Issue
Block a user