Switch roster to 武汉自投投放下单_AM&Media Buy.xlsx
New roster is a strict superset of 投手.xlsx (14 added, none removed, no reassignments). build_data.py now picks the roster by an explicit precedence list, so the old 投手.xlsx stays as a fallback. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+10
-6
@@ -30,13 +30,17 @@ books = [(f, openpyxl.load_workbook(f, data_only=True)) for f in SRC_FILES]
|
||||
# --- 投手花名册 ---
|
||||
# 优先用独立的 投手.xlsx(月度数据文件已不再带「投手」sheet);
|
||||
# 没有它时退回到最新一个仍带该 sheet 的月度文件。
|
||||
ROSTER_XLSX = os.path.join(HERE, '投手.xlsx')
|
||||
# 花名册候选,按优先级从高到低;命中第一个就用它。
|
||||
ROSTER_PATTERNS = ['武汉自投投放下单*.xlsx', '投手.xlsx']
|
||||
roster_file, roster = None, None
|
||||
if os.path.exists(ROSTER_XLSX):
|
||||
_rwb = openpyxl.load_workbook(ROSTER_XLSX, data_only=True)
|
||||
roster_file = ROSTER_XLSX
|
||||
roster = _rwb['投手'] if '投手' in _rwb.sheetnames else _rwb[_rwb.sheetnames[0]]
|
||||
else:
|
||||
for pat in ROSTER_PATTERNS:
|
||||
hits = sorted(glob.glob(os.path.join(HERE, pat)))
|
||||
if hits:
|
||||
roster_file = hits[-1]
|
||||
_rwb = openpyxl.load_workbook(roster_file, data_only=True)
|
||||
roster = _rwb['投手'] if '投手' in _rwb.sheetnames else _rwb[_rwb.sheetnames[0]]
|
||||
break
|
||||
if roster is None:
|
||||
for f, wb_ in reversed(books):
|
||||
if '投手' in wb_.sheetnames:
|
||||
roster_file, roster = f, wb_['投手']
|
||||
|
||||
Reference in New Issue
Block a user