Skip to content

Commit ff96de4

Browse files
some logic / arch fixes
1 parent 5508cb9 commit ff96de4

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

app/main/checks/report_checks/sw_section_banned_words.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ def check_text(text, banned_words):
4848
feedback = ""
4949
for chapter in chapters:
5050
if chapter['name'] in self.sections:
51-
feedback += check_text(chapter['text'], self.sections[chapter['name']])
51+
found_banned_words = check_text(chapter['text'], self.sections[chapter['name']])
52+
if found_banned_words:
53+
feedback += f"<br>Раздел '{chapter['name']}' содержит запрещенные слова {found_banned_words}"
5254

5355
# check subchapters text too
5456
if chapter['node'].get('children'):

app/main/checks/report_checks/sw_section_lit_reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def check(self):
5252
self.search_references(chapter['text'])[0])
5353
subchapter_result = []
5454

55-
if chapter['node']['children']:
55+
if chapter['node'].get('children'):
5656
for subchapter in chapter['node']['children']:
5757
subchapter_references = len(
5858
self.search_references(subchapter['text'])[0])

app/main/reports/md_uploader/md_uploader.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ def __init__(self, filepath):
5858
self.headers_main = ''
5959
self.html_text = ''
6060
self.headers_page = 1
61+
self.str_chapters = None
62+
self.tree_chapters = None
63+
6164

6265
def upload(self):
6366
with open(self.filepath, "r", encoding="utf-8") as f:
@@ -149,16 +152,19 @@ def make_chapters(self, work_type):
149152
return self.chapters
150153

151154
def chapters_to_str(self):
155+
if self.str_chapters: return self.str_chapters
152156
result = []
153157
for chapter in self.chapters:
154158
result.append({
155159
"style": chapter['style'],
156160
"name": re.sub(r"<[\/\w]*>", "", chapter['text']),
157161
"text": "".join(re.sub(r"<[\/\w]*>", "", child['text']) for child in chapter['child'])
158162
})
163+
self.str_chapters = result
159164
return result
160165

161166
def build_chapter_tree(self, chapters):
167+
if self.tree_chapters: return self.tree_chapters
162168
tree = []
163169
stack = [tree]
164170

@@ -180,6 +186,7 @@ def build_chapter_tree(self, chapters):
180186

181187
chapter['node'] = new_chapter
182188

189+
self.tree_chapters = tree
183190
return tree
184191

185192
def get_tables_size(self):

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ services:
99
- "${WEB_PORT:-8080}:8080"
1010
depends_on:
1111
- mongodb
12-
- worker
12+
- redis
1313
env_file:
1414
- .env
1515
environment:

0 commit comments

Comments
 (0)