主要功能更新: - 崗位描述保存功能:保存後資料寫入資料庫 - 崗位清單自動刷新:切換模組時自動載入最新資料 - 崗位清單檢視功能:點擊「檢視」按鈕載入對應描述 - 管理者頁面擴充:新增崗位資料管理與匯出功能 - CSV 批次匯入:支援崗位與職務資料批次匯入 後端 API 新增: - Position Description CRUD APIs - Position List Query & Export APIs - CSV Template Download & Import APIs 文件更新: - SDD.md 更新至版本 2.1 - README.md 更新功能說明與版本歷史 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
54 lines
1.6 KiB
Python
54 lines
1.6 KiB
Python
"""
|
|
修復 app_updated.py 中重複的 CSV 路由
|
|
"""
|
|
|
|
import re
|
|
|
|
# 讀取檔案
|
|
with open('app_updated.py', 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
# 找到並刪除重複的 CSV 匯入/匯出 API 區塊 (第 852 行開始)
|
|
# 保留第一次定義(已經移到正確位置的),刪除後面的重複定義
|
|
|
|
# 找到 "# ==================== CSV 匯入/匯出 API ====================" 的位置
|
|
csv_section_pattern = r'# ====================CSV匯入/匯出 API ====================.*?(?=# ====================)'
|
|
|
|
# 刪除重複的 CSV 區塊 (保留第一次定義)
|
|
lines = content.split('\n')
|
|
new_lines = []
|
|
skip_until_next_section = False
|
|
first_csv_section_found = False
|
|
|
|
i = 0
|
|
while i < len(lines):
|
|
line = lines[i]
|
|
|
|
# 檢查是否是 CSV 匯入/匯出 API 區段
|
|
if '# ==================== CSV 匯入/匯出 API ====================' in line:
|
|
if not first_csv_section_found:
|
|
# 第一次遇到,跳過這個區塊(因為我們已經在前面定義了)
|
|
first_csv_section_found = True
|
|
skip_until_next_section = True
|
|
else:
|
|
# 第二次遇到重複區塊,跳過
|
|
skip_until_next_section = True
|
|
|
|
# 檢查是否遇到下一個區段
|
|
if skip_until_next_section and '# ====================' in line and 'CSV 匯入/匯出' not in line:
|
|
skip_until_next_section = False
|
|
new_lines.append(line)
|
|
i += 1
|
|
continue
|
|
|
|
if not skip_until_next_section:
|
|
new_lines.append(line)
|
|
|
|
i += 1
|
|
|
|
# 寫回檔案
|
|
with open('app_updated.py', 'w', encoding='utf-8') as f:
|
|
f.write('\n'.join(new_lines))
|
|
|
|
print("已修復 CSV 路由重複問題")
|