diff --git a/code2text.py b/code2text.py new file mode 100644 index 0000000..0a7428e --- /dev/null +++ b/code2text.py @@ -0,0 +1,31 @@ +import os + +def generate_codebase(root_dir, output_file): + # Папки, которые мы игнорируем + ignore_dirs = {'.git', 'vendor', '__pycache__', 'node_modules', '.idea', '.vscode'} + # Расширения файлов, которые нам не нужны (бинарники и контрольные суммы) + ignore_exts = {'.pyc', '.sum', '.exe', '.dll', '.so', '.pdf', '.png', '.jpg'} + + with open(output_file, 'w', encoding='utf-8') as outfile: + for root, dirs, files in os.walk(root_dir): + # Исключаем игнорируемые директории, модифицируя список dirs на месте + dirs[:] = [d for d in dirs if d not in ignore_dirs] + + for file in files: + # Пропускаем сам выходной файл, этот скрипт и файлы с ненужными расширениями + if file == output_file or file == "code2text.py" or any(file.endswith(ext) for ext in ignore_exts): + continue + + filepath = os.path.join(root, file) + try: + with open(filepath, 'r', encoding='utf-8') as infile: + outfile.write(f"\n\n=== ФАЙЛ: {filepath} ===\n") + outfile.write(infile.read()) + except Exception as e: + # Если файл нельзя прочитать как текст (например, это картинка без расширения), просто запишем ошибку и пойдем дальше + outfile.write(f"\n\n=== ПРОПУЩЕН БИНАРНЫЙ ФАЙЛ ИЛИ ОШИБКА ЧТЕНИЯ: {filepath} ===\n") + +if __name__ == "__main__": + # Меняем '.' на './service/telegram_service' (или как у вас называется эта папка) + generate_codebase('./service/telegram_service', 'telegram_codebase.txt') + print("Готово! Код собран в файл telegram_codebase.txt") diff --git a/core/lib/internally/monthly_orders/service.go b/core/lib/internally/monthly_orders/service.go index 711e3ac..be90554 100644 --- a/core/lib/internally/monthly_orders/service.go +++ b/core/lib/internally/monthly_orders/service.go @@ -404,17 +404,12 @@ func (s *MonthlyOrderService) SubmitOrdersToTelegram(ctx context.Context, manage nomName = *item.NomenclatureName } - nomType := "" - if item.NomenclatureType != nil && *item.NomenclatureType != "" { - nomType = fmt.Sprintf(" (%s)", *item.NomenclatureType) - } - qty := 0 if item.Quantity != nil { qty = *item.Quantity } - contentBuilder.WriteString(fmt.Sprintf("- %s%s: %d шт.\n", nomName, nomType, qty)) + contentBuilder.WriteString(fmt.Sprintf("- %s: %d шт.\n", nomName, qty)) order.Items = append(order.Items, *item) }