mirror of
https://gitflic.ru/project/maks1ms/ocab.git
synced 2024-12-23 16:23:01 +03:00
добавлены правки
This commit is contained in:
parent
36dbab06d3
commit
8b7e8e1170
@ -20,7 +20,7 @@ bot_modules = [
|
||||
FSLoader(f"{paths.modules_standard}/command_helper"),
|
||||
FSLoader(f"{paths.modules_standard}/info"),
|
||||
FSLoader(f"{paths.modules_standard}/filters"),
|
||||
FSLoader(f"{paths.modules_standard}/create_report_apps"),
|
||||
FSLoader(f"{paths.modules_external}/create_report_apps"),
|
||||
FSLoader(f"{paths.modules_standard}/admin"),
|
||||
FSLoader(f"{paths.modules_standard}/message_processing"),
|
||||
]
|
||||
|
@ -11,7 +11,7 @@ class ModuleInfo:
|
||||
name: str
|
||||
description: str
|
||||
version: str
|
||||
author: str
|
||||
author: str | list[str]
|
||||
privileged: bool
|
||||
dependencies: dict
|
||||
|
||||
|
@ -129,8 +129,8 @@ async def additional_info_entered(message: Message, state: FSMContext):
|
||||
data = await state.get_data()
|
||||
|
||||
report = Report(data)
|
||||
file_report = report.export(html=False).encode()
|
||||
file_report = report.export().encode()
|
||||
|
||||
await message.answer(text=report.export(html=True), parse_mode=ParseMode.HTML)
|
||||
await message.answer(text=report.export())
|
||||
await message.answer_document(document=BufferedInputFile(file_report, "report.txt"))
|
||||
await state.clear()
|
@ -1,8 +1,11 @@
|
||||
{
|
||||
"id": "standard.create_report_apps",
|
||||
"id": "external.create_report_apps",
|
||||
"name": "Create Report Apps",
|
||||
"description": "Модуль для создания отчетов о ошибках в приложениях",
|
||||
"author": "OCAB Team",
|
||||
"author": [
|
||||
"OCAB Team",
|
||||
"Maxim Slipenko"
|
||||
],
|
||||
"version": "1.0.0",
|
||||
"privileged": false,
|
||||
"dependencies": {
|
59
src/ocab_modules/external/create_report_apps/report.py
vendored
Normal file
59
src/ocab_modules/external/create_report_apps/report.py
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
import aiogram
|
||||
|
||||
|
||||
class ReportFormatter:
|
||||
def __init__(self, html=True):
|
||||
self.html = html
|
||||
|
||||
def bold(self, string):
|
||||
if self.html:
|
||||
return f"<b>{self.text(string)}</b>"
|
||||
return self.text(string)
|
||||
|
||||
def text(self, string):
|
||||
if self.html:
|
||||
return aiogram.html.quote(string)
|
||||
return string
|
||||
|
||||
|
||||
class Report:
|
||||
def __init__(self, data: dict):
|
||||
self.data = data
|
||||
|
||||
def export(self):
|
||||
data = self.data
|
||||
|
||||
report = f"""
|
||||
Стенд с ошибкой:
|
||||
==============================
|
||||
|
||||
{data['system']}
|
||||
|
||||
Пакет:
|
||||
==============================
|
||||
|
||||
{data['app']}
|
||||
|
||||
Шаги, приводящие к ошибке:
|
||||
==============================
|
||||
|
||||
{data['problem_step_by_step']}
|
||||
|
||||
Фактический результат:
|
||||
==============================
|
||||
|
||||
{data['actual']}
|
||||
|
||||
Ожидаемый результат:
|
||||
==============================
|
||||
|
||||
{data['expected']}
|
||||
"""
|
||||
if data["additional"] != "":
|
||||
report += f"""
|
||||
Дополнительно:
|
||||
==============================
|
||||
|
||||
{data['additional']}
|
||||
"""
|
||||
return report
|
@ -1,53 +0,0 @@
|
||||
import aiogram
|
||||
|
||||
|
||||
class ReportFormatter:
|
||||
def __init__(self, html=True):
|
||||
self.html = html
|
||||
|
||||
def bold(self, string):
|
||||
if self.html:
|
||||
return f"<b>{self.text(string)}</b>"
|
||||
return self.text(string)
|
||||
|
||||
def text(self, string):
|
||||
if self.html:
|
||||
return aiogram.html.quote(string)
|
||||
return string
|
||||
|
||||
|
||||
class Report:
|
||||
def __init__(self, data: dict):
|
||||
self.data = data
|
||||
|
||||
def export(self, html=True):
|
||||
data = self.data
|
||||
f = ReportFormatter(html)
|
||||
|
||||
report = f"""{f.bold("Стенд с ошибкой:")}
|
||||
|
||||
{f.text(data['system'])}
|
||||
|
||||
{f.bold("Версия программы:")}
|
||||
|
||||
{f.text(data['app'])}
|
||||
|
||||
{f.bold("Шаги, приводящие к ошибке:")}
|
||||
|
||||
{f.text(data['problem_step_by_step'])}
|
||||
|
||||
{f.bold("Результат:")}
|
||||
|
||||
{f.text(data['actual'])}
|
||||
|
||||
{f.bold("Ожидаемый результат:")}
|
||||
|
||||
{f.text(data['expected'])}
|
||||
"""
|
||||
if data["additional"] != "":
|
||||
report += f"""{f.bold("Дополнительно:")}
|
||||
|
||||
{f.text(data['additional'])}
|
||||
"""
|
||||
|
||||
return report
|
Loading…
Reference in New Issue
Block a user