-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
1,187 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ SIGNUP_PAGE_ENABLED=... | |
CONSUMER_KEY=... | ||
CONSUMER_SECRET=... | ||
ACCESS_TOKEN=... | ||
``` | ||
|
||
## Run | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
app/main/checks/presentation_checks/name_of_image_check.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from ..base_check import BasePresCriterion, answer | ||
from utils import name_of_image_check_results | ||
|
||
class PresImageCaptureCheck(BasePresCriterion): | ||
label = "Проверка наличия подписи к рисункам" | ||
description = 'Подписи к рисункам должны содержать слово "Рисунок". Подпись к рисункам на слайдах без текста необязательна' | ||
id = 'pres_image_capture' | ||
|
||
def __init__(self, file_info): | ||
super().__init__(file_info) | ||
|
||
def check(self): | ||
slides_without_capture = set() | ||
slide_with_image_only = set() | ||
result_str = 'Не пройдена! ' | ||
all_captions = [] | ||
for num, slide in enumerate(self.file.slides, 1): | ||
captions = slide.get_captions() | ||
if captions: | ||
for caption in captions: | ||
body_text = slide.get_text().replace(captions[0][0], '').replace(slide.get_title(), '').replace('<number>', '').replace(' ', '') | ||
if body_text.strip() or slide.get_table(): | ||
all_captions.append(caption[0]) | ||
if 'Рисунок' not in caption[0]: | ||
slides_without_capture.add(num) | ||
else: | ||
if caption[0] != slide.get_title(): | ||
slide_with_image_only.add(num) | ||
if slides_without_capture: | ||
result_str += ( | ||
'Подписи к рисункам на следующих слайдах отсутствуют или не содержат слова "Рисунок": {}'.format( | ||
', '.join(self.format_page_link(sorted(slides_without_capture)))) + '<br>') | ||
if slide_with_image_only: | ||
result_str += ( | ||
'Подписи к рисункам на следующих слайдах без текста необязательны: {}'.format( | ||
', '.join(self.format_page_link(sorted(slide_with_image_only)))) + '<br>') | ||
if result_str: | ||
return answer(False, name_of_image_check_results(result_str, all_captions)) | ||
else: | ||
return answer(True, 'Пройдена!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import re | ||
from ..base_check import BaseReportCriterion, answer | ||
|
||
PAGE_NAME = "ЗАДАНИЕ НА ВЫПУСКНУЮ КВАЛИФИКАЦИОННУЮ РАБОТУ" | ||
|
||
|
||
class EmptyTaskPageCheck(BaseReportCriterion): | ||
label = "Проверка на пустоту страницы с заданием" | ||
description = f'Страница "{PAGE_NAME}" должна содержать текст' | ||
id = 'empty_task_page_check' | ||
|
||
def __init__(self, file_info): | ||
super().__init__(file_info) | ||
self.check_words = {'студент', 'руководитель', 'тема работы'} | ||
self.check_first_pattern = r'^студент+[а-яА-ЯёЁa-zA-Z]+группа\d+$' | ||
self.check_date_pattern = r'^«\d+»[а-яА-ЯёЁa-zA-Z]+20\d+г«\d+»[а-яА-ЯёЁa-zA-Z]+20\d+г$' | ||
self.result = {'Cтудент, Группа', 'Дата выдачи задания, Дата представления ВКР к защите', 'Студент', 'Руководитель', 'Тема работы'} | ||
|
||
def check(self): | ||
if self.file.page_counter() < 4: | ||
return answer(False, "В отчете недостаточно страниц. Нечего проверять.") | ||
rows_text = self.file.pdf_file.page_rows_text(1) | ||
if 'ЗАДАНИЕ' not in rows_text[0][4]: | ||
return answer(False, f'Страница "{PAGE_NAME}" не найдена. Убедитесь, что она является второй в документе и не содержит ошибок в заголовке.') | ||
elif len(rows_text) < 4: | ||
return answer(False, f'Страница "{PAGE_NAME}" не содержит текста.') | ||
else: | ||
start_string = 0 | ||
for row in rows_text: | ||
row_string = row[4].replace('\n', '').replace('.', '').replace(' ', '').replace('_', '').lower() | ||
if re.match(self.check_first_pattern, row_string): | ||
self.result.discard('Cтудент, Группа') | ||
start_string = row[5] | ||
if re.match(self.check_date_pattern, row_string): | ||
self.result.discard('Дата выдачи задания, Дата представления ВКР к защите') | ||
for k in self.check_words: | ||
for row in rows_text[start_string+1:]: | ||
row_string = row[4].replace('\n', '').replace(' ', '').replace('_', '').lower() | ||
if k.replace(' ', '') in row_string: | ||
if len(row_string) > (len(k)+2): | ||
self.result.discard(k.capitalize()) | ||
if not self.result: | ||
return answer(True, 'Пройдена!') | ||
else: | ||
return answer(False, f'Некоторые необходимые поля пусты или отсутствуют. Проверьте поля: «{"», «".join(self.result)}»') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.