Skip to content

Commit

Permalink
add sw_tasks_check (for sw tasks 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
HadronCollider committed Oct 28, 2024
1 parent 2f0b8f9 commit e673f8c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/main/checks/report_checks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@
from .template_name import ReportTemplateNameCheck
from .key_words_check import KeyWordsReportCheck
from .empty_task_page_check import EmptyTaskPageCheck
from .sw_tasks import SWTasksCheck
from .sw_section_size import SWSectionSizeCheck
28 changes: 28 additions & 0 deletions app/main/checks/report_checks/sw_tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from ..base_check import BaseReportCriterion, answer
from logging import getLogger


logger = getLogger('root')


class SWTasksCheck(BaseReportCriterion):
label = "Проверка количества задач исследования"
description = "Проверка количества задач исследования"
id = "sw_tasks_check"
priority = True

def __init__(self, file_info, min_tasks=3, max_tasks=5):
super().__init__(file_info)

self.min_tasks = min_tasks
self.max_tasks = max_tasks

def check(self):
self.file.make_chapters('VKR')
for chapter in self.file.chapters:
if "Задачи" in chapter['text']:
if self.min_tasks <= len(chapter['child']) <= self.max_tasks:
return answer(1, "Проверка пройдена!")
feedback = f"Количество задач исследования должно быть в диапазоне [{self.min_tasks};{self.max_tasks}], сейчас их {len(chapter['child'])}"
return answer(0, feedback)
return answer(1, "Проверка пройдена!")

0 comments on commit e673f8c

Please sign in to comment.