This commit is contained in:
@@ -137,6 +137,7 @@ def setup_routes(app: FastAPI) -> None:
|
|||||||
# 2. Собираем все файлы .docx за период
|
# 2. Собираем все файлы .docx за период
|
||||||
all_files = []
|
all_files = []
|
||||||
current_date = start_date
|
current_date = start_date
|
||||||
|
finish_date += timedelta(days=1)
|
||||||
while current_date <= finish_date:
|
while current_date <= finish_date:
|
||||||
date_path = current_date.strftime("%Y/%m/%d")
|
date_path = current_date.strftime("%Y/%m/%d")
|
||||||
full_dir_path = os.path.join(DOCUMENTS_DIR, date_path)
|
full_dir_path = os.path.join(DOCUMENTS_DIR, date_path)
|
||||||
@@ -144,7 +145,6 @@ def setup_routes(app: FastAPI) -> None:
|
|||||||
if os.path.exists(full_dir_path):
|
if os.path.exists(full_dir_path):
|
||||||
for file in os.listdir(full_dir_path):
|
for file in os.listdir(full_dir_path):
|
||||||
if file.endswith('.docx'):
|
if file.endswith('.docx'):
|
||||||
# 3. Фильтруем: добавляем только если название файла совпадает с заголовком из БД
|
|
||||||
file_title = file[:-5] # убираем расширение .docx
|
file_title = file[:-5] # убираем расширение .docx
|
||||||
if file_title in titles_from_db:
|
if file_title in titles_from_db:
|
||||||
all_files.append(os.path.join(full_dir_path, file))
|
all_files.append(os.path.join(full_dir_path, file))
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ def update_bd_and_create_document(
|
|||||||
|
|
||||||
doc = Document()
|
doc = Document()
|
||||||
doc.add_heading('Ссылка на статью', level=1)
|
doc.add_heading('Ссылка на статью', level=1)
|
||||||
doc.add_paragraph(other)
|
doc.add_paragraph(url)
|
||||||
doc.add_heading('Дата и время', level=1)
|
doc.add_heading('Дата и время', level=1)
|
||||||
doc.add_paragraph(article_date)
|
doc.add_paragraph(article_date)
|
||||||
doc.add_heading('Обнаруженные тематики текста', level=1)
|
doc.add_heading('Обнаруженные тематики текста', level=1)
|
||||||
|
|||||||
Reference in New Issue
Block a user