Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions barista/barista/doctype/test_suite/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,15 @@ def fix_series():
max_test_data_series = frappe.db.sql_list(
"""select ifnull(max(name),'TestData-0') from `tabTest Data`;""")
if len(max_test_data_series):
max_test_data_series = int(max_test_data_series[0].split('-')[1])
try:
# Extract the numeric part after the last dash
parts = max_test_data_series[0].split('-')
if len(parts) > 1 and parts[-1].isdigit():
max_test_data_series = int(parts[-1])
else:
max_test_data_series = 0
except (ValueError, IndexError):
max_test_data_series = 0
if len(test_data_series) == 0:
frappe.db.sql(
f"""Insert into `tabSeries` (name,current) values ('TestData-',{max_test_data_series});""", auto_commit=1)
Expand All @@ -230,7 +238,15 @@ def fix_series():
max_test_case_series = frappe.db.sql_list(
"""select ifnull(max(name),'TestCase-0') from `tabTest Case`;""")
if len(max_test_case_series):
max_test_case_series = int(max_test_case_series[0].split('-')[1])
try:
# Extract the numeric part after the last dash
parts = max_test_case_series[0].split('-')
if len(parts) > 1 and parts[-1].isdigit():
max_test_case_series = int(parts[-1])
else:
max_test_case_series = 0
except (ValueError, IndexError):
max_test_case_series = 0
if len(test_case_series) == 0:
frappe.db.sql(
f"""Insert into `tabSeries` (name,current) values ('TestCase-',{max_test_case_series});""", auto_commit=1)
Expand Down