Skip to content

Commit

Permalink
Merge branch 'verdicts'
Browse files Browse the repository at this point in the history
  • Loading branch information
HadronCollider committed Aug 15, 2021
2 parents 068bfd3 + c387f74 commit 75af297
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 87 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ RUN python3.8 -m pip install -r dependencies.txt
ENV PYTHONPATH "${PYTHONPATH}:/usr/src/project"

RUN ./act.sh -b
RUN npm audit fix
CMD ./scripts/local_start.sh
7 changes: 3 additions & 4 deletions app/main/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import itertools
from app.nlp.similarity_of_texts import check_similarity
from app.nlp.find_tasks_on_slides import find_tasks_on_slides
from app.utils.parse_for_html import find_tasks_on_slides_feedback, tasks_conclusions_feedback
from app.main.checks.sld_num import SldNumCheck
from app.main.checks.title_format import TitleFormatCheck
from app.main.checks.base_check import answer
Expand Down Expand Up @@ -60,7 +61,7 @@ def __are_slides_similar(goals, conclusions, actual_number):
if results == -1:
return answer(False, None, "Произошла ошибка!"), answer(False, None, "Произошла ошибка!")
else:
return (answer(results[0] >= actual_number, results[0], 'Соответствует на {}%'.format(results[0]), 'Распознанные заключения: ', *results[2]),
return (answer(results[0] >= actual_number, results[0], *tasks_conclusions_feedback(results)),
answer(results[1].get('found_dev'), results[1].get('dev_sentence'), results[1].get('dev_sentence')))


Expand All @@ -76,9 +77,7 @@ def __find_tasks_on_slides(presentation, goals, intersection_number):
return answer(True, "Все задачи найдены на слайдах", "Все задачи найдены на слайдах")
elif len(slides_with_tasks) == 3 :
logger.info("\tНекоторые из заявленных задач на слайдах не найдены")
return answer(False, slides_with_tasks, 'Всего задач: {}'.format(slides_with_tasks.get('count')), \
'Распознанные задачи: ', *slides_with_tasks.get('recognized'), \
'Не найдены: ', *slides_with_tasks.get('not_found'))
return answer(False, slides_with_tasks, *find_tasks_on_slides_feedback(slides_with_tasks))
elif len(slides_with_tasks) == 1:
return answer(False, slides_with_tasks, slides_with_tasks)

Expand Down
21 changes: 21 additions & 0 deletions app/utils/parse_for_html.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from argparse import Namespace
tags = {'br': '<br>', 'close_div': '</div>', 'div_class': '<div class="format_description">'}
tag = Namespace(**tags)

def format_descriptions(desc_list, open_tag = '', close_tag = ''):
return list(map(lambda item: f"{open_tag}{item}{close_tag}", desc_list))

def format_header(header, close_tag = ''):
return f"{header}{close_tag}"

def find_tasks_on_slides_feedback(slides_with_tasks):
return format_header('Всего задач: {}'.format(slides_with_tasks.get('count')), tag.br), \
'Распознанные задачи: ', \
*format_descriptions(slides_with_tasks.get('recognized'), tag.div_class, tag.br + tag.close_div), \
'Не найдены: ', \
*format_descriptions(slides_with_tasks.get('not_found'), tag.div_class, tag.br + tag.close_div)

def tasks_conclusions_feedback(results):
return format_header('Соответствует на {}%'.format(results[0]), tag.br), \
'Распознанные заключения: ', \
*format_descriptions(results[2], tag.div_class, tag.br + tag.close_div)
2 changes: 2 additions & 0 deletions assets/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import 'bootstrap-table/dist/bootstrap-table.min.css'
import 'bootstrap-table/dist/extensions/filter-control/bootstrap-table-filter-control'
import 'bootstrap-table/dist/extensions/filter-control/bootstrap-table-filter-control.min.css'

import 'bootstrap-icons/font/bootstrap-icons.css'

import 'bootstrap-datepicker';
import 'bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css'

Expand Down
6 changes: 6 additions & 0 deletions assets/styles/results.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
width: 45%;
}

.hiddenRow {
padding: 0 !important;
}

.format_description {
margin-left: 2em;
}

#results_holder {
overflow: auto;
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"css-loader": "^6.2.0",
"crypto-js": "^3.1.2",
"bootstrap-datepicker": "^1.9.0",
"bootstrap-table": "^1.18.3"
"bootstrap-table": "^1.18.3",
"bootstrap-icons": "1.5.0"
}
}
204 changes: 122 additions & 82 deletions templates/results.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');

module.exports = {
mode: 'production',
entry: ['core-js/stable', 'regenerator-runtime/runtime', "./assets/scripts/main.js"],
output: {
path: path.join(__dirname, './src/'),
Expand Down

0 comments on commit 75af297

Please sign in to comment.