diff --git a/app.py b/app.py index 0e3652a..33dedc0 100644 --- a/app.py +++ b/app.py @@ -679,6 +679,7 @@ def upload_workplaces(): wp['id'] = f'p{offset}' offset += 1 t['workplaces'] = existing + new_workplaces + t['workplace_filename'] = file.filename total = len(t['workplaces']) update_progress('완료', f'근무처 업로드 완료 (총 {total}개, 이번 {len(new_workplaces)}개)') @@ -826,7 +827,11 @@ def export(): ws.append([w['name'], w['hope'], w['address'], w['dob'], w['phone']]) elif export_type == 'assigned': - template_path = '선거참관인_배치_와꾸_.xlsx' + wp_filename = t.get('workplace_filename', '') + base = os.path.splitext(wp_filename)[0] + template_path = f'{base}_template.xlsx' if base else '' + if not template_path or not os.path.exists(template_path): + template_path = '선거참관인_배치_와꾸_.xlsx' if os.path.exists(template_path): wb = openpyxl.load_workbook(template_path) wp_workers = {}