fix: task failure when without a recipient column

This commit is contained in:
2026-06-17 14:52:43 +08:00
parent a259d98ce9
commit 1166ee2e9e
+4 -3
View File
@@ -393,7 +393,6 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
try: try:
flow.react(Wait) flow.react(Wait)
attempts += 1 attempts += 1
name = cell(index, column.recipient).value
email = cell(index, column.email).value email = cell(index, column.email).value
try: code = str(cell(index, column.code).value) try: code = str(cell(index, column.code).value)
@@ -440,7 +439,6 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
flow.allow(Skip) flow.allow(Skip)
flow.react(Wait) flow.react(Wait)
progress['email'] = str(email) progress['email'] = str(email)
progress['recipient'] = str(name)
logger.info('[%d/%d] Sending to %s', index-1, limit-1, email) logger.info('[%d/%d] Sending to %s', index-1, limit-1, email)
clean = True clean = True
error = None error = None
@@ -470,7 +468,10 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
action = ActionChains(driver) action = ActionChains(driver)
hello = hello or locale.default hello = hello or locale.default
if name is not None and (name := str(name).strip()) and not contains_non_latin_alphabet(name): if column.recipient in headers:
if name := str(cell(index, column.recipient).value).strip():
if not contains_non_latin_alphabet(name):
progress['recipient'] = str(name)
parts = HumanName(name) parts = HumanName(name)
parts.capitalize(force=True) parts.capitalize(force=True)
short = len(parts.first) < 3 or (len(parts.first) < 5 and parts.first.endswith('.')) short = len(parts.first) < 3 or (len(parts.first) < 5 and parts.first.endswith('.'))