Skip to content

Commit

Permalink
result work_sheet xlsx
Browse files Browse the repository at this point in the history
  • Loading branch information
Well authored and Well committed Jul 8, 2024
1 parent 8b5ea97 commit 6d238ef
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def handle(self, *args, **kwargs):
ws = wb[wb.sheetnames[0]]

starts = False
code_idx, conditions_idx, start_ref_idx, end_ref_idx = None, None, None, None
code_idx, title_idx, conditions_idx, start_ref_idx, end_ref_idx = None, None, None, None, None
fraction = None
result_wb = Workbook()
result_ws = result_wb[result_wb.sheetnames[0]]
Expand All @@ -39,15 +39,18 @@ def handle(self, *args, **kwargs):
if "Условия" in cells:
code_idx = cells.index("Код")
conditions_idx = cells.index("Условия")
title_idx = cells.index("Тест")
start_ref_idx = cells.index("Нижняя Гр.")
end_ref_idx = cells.index("Верхняя Гр.")
starts = True
else:
code = cells[code_idx].strip()
title = cells[title_idx].strip()
conditions = cells[conditions_idx].strip()
start = cells[start_ref_idx].strip()
end = cells[end_ref_idx].strip()
if start == "None" or end == "None":
result_ws.append([code, title, '-'])
continue
tmp_cond_str = conditions.split("Пол: ")
age = ""
Expand All @@ -71,6 +74,7 @@ def handle(self, *args, **kwargs):
age = f"дней {age_start}-{age_end}"
except Exception:
self.stdout.write("Не удалось преобразовать в дни")
result_ws.append([code, title, '-'])
continue
elif not age:
age = "Все"
Expand All @@ -89,6 +93,7 @@ def handle(self, *args, **kwargs):
ref_m, ref_f = [], []
fraction = Fractions.objects.filter(external_code__iexact=code).first()
if not fraction:
result_ws.append([code, title, '-'])
continue

if gender.lower() == "общий":
Expand Down

0 comments on commit 6d238ef

Please sign in to comment.