-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
451 message about point #457
base: master
Are you sure you want to change the base?
Changes from 7 commits
4f21f15
4fd8174
99df8c8
6a9d964
fcf5945
53b5559
729ab79
7f7b238
bd29f37
68b766d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from bson import ObjectId | ||
from flask_login import UserMixin | ||
|
||
from main.check_packs import BASE_PACKS, BaseCriterionPack, DEFAULT_TYPE_INFO, DEFAULT_REPORT_TYPE_INFO | ||
from main.check_packs import BASE_PACKS, BaseCriterionPack, DEFAULT_TYPE_INFO, DEFAULT_REPORT_TYPE_INFO, POINT_LEVELS | ||
|
||
class Packable: | ||
def __init__(self, dictionary): | ||
|
@@ -104,6 +104,7 @@ def __init__(self, dictionary=None): | |
self.is_failed = dictionary.get('is_failed', None) | ||
self.is_ended = dictionary.get('is_ended', True) | ||
self.is_passed = dictionary.get('is_passed', int(self.score) == 1) | ||
self.point_levels = self.get_point_levels() | ||
|
||
def calc_score(self): | ||
# check after implementation criterion pack | ||
|
@@ -145,3 +146,10 @@ def none_to_false(x): | |
is_ended = none_to_true(self.is_ended) # None for old checks => True, True->True, False->False | ||
is_failed = none_to_false(self.is_failed) # None for old checks => False, True->True, False->False | ||
return {'is_ended': is_ended, 'is_failed': is_failed} | ||
|
||
def get_point_levels(self): | ||
for key in POINT_LEVELS: | ||
value = POINT_LEVELS[key] | ||
if value[0] < self.score < value[1]: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. может какую-то границу надо включить? (не уверен) |
||
point_levels = key | ||
return point_levels |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from .base_criterion_pack import BaseCriterionPack | ||
from .pack_config import BASE_PACKS, DEFAULT_TYPE, DEFAULT_TYPE_INFO, DEFAULT_PRES_TYPE_INFO, DEFAULT_REPORT_TYPE_INFO, \ | ||
REPORT_TYPES | ||
REPORT_TYPES, POINT_LEVELS | ||
from .utils import init_criterions |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,10 +46,16 @@ | |
DEFAULT_REPORT_TYPE_INFO = {'type': 'report', 'report_type': REPORT_TYPES[1]} | ||
DEFAULT_PRES_TYPE_INFO = {'type': 'pres'} | ||
DEFAULT_TYPE_INFO = DEFAULT_PRES_TYPE_INFO | ||
POINT_LEVELS = {"message1": [0.4, 0.6], | ||
'Message2': [0.6, 0.7], | ||
'Вы набрали необходимый минимум для дальнейшего допуска на защиту ВКР с оценкой "Допущен с рекомендацией значительно снизить оценку". Однако, мы рекомендуем вам продолжить исправления презентации для получения максимального балла. Это повысит ваш допуск до уровня "Допущен".': [0.7, 0.8], | ||
'Вы набрали необходимый минимум для дальнейшего допуска на защиту ВКР с оценкой "Допущен с рекомендацией снизить оценку". Однако, мы рекомендуем вам продолжить исправления презентации для получения максимального балла. Это повысит ваш допуск до уровня "Допущен".': [0.8, 0.998], | ||
'Уровень Вашего допуска "Допущен"': [0.999, ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
BASE_PACKS = { | ||
'pres': BaseCriterionPack(BASE_PRES_CRITERION, DEFAULT_PRES_TYPE_INFO, min_score=1.0, | ||
'pres': BaseCriterionPack(BASE_PRES_CRITERION, DEFAULT_PRES_TYPE_INFO, point_levels=POINT_LEVELS, min_score=1.0, | ||
name="BasePresentationCriterionPack"), | ||
'report': BaseCriterionPack(BASE_REPORT_CRITERION, DEFAULT_REPORT_TYPE_INFO, min_score=1.0, | ||
'report': BaseCriterionPack(BASE_REPORT_CRITERION, DEFAULT_REPORT_TYPE_INFO, point_levels=POINT_LEVELS, min_score=1.0, | ||
name="BaseReportCriterionPack") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,13 @@ const RAW_CRITERION_VALIDATION_ERRORS = { | |
'not_json': 'Строка не является JSON-строкой', | ||
} | ||
|
||
$("#btn_tab1").click(function(){ | ||
openTab('tab1'); | ||
}); | ||
$("#btn_tab2").click(function(){ | ||
openTab('tab2'); | ||
}); | ||
|
||
$("#file_type").change(function () { | ||
switch ($(this).val()) { | ||
case "pres": { | ||
|
@@ -43,6 +50,7 @@ pack_form.submit((e) => { | |
fd.append('report_type', $("#report_type").val()); | ||
fd.append('min_score', $("#min_score").val()); | ||
fd.append('raw_criterions', raw_criterions_str); | ||
fd.append('point_levels', $("#point_levels").val()); | ||
fetch(`/api/criterion_pack`, {method: "POST", body: fd}) | ||
.then(response => { | ||
if (response.status === 200) { | ||
|
@@ -72,4 +80,17 @@ function verifyRawCriterions(text) { | |
console.log(text, e) | ||
return 1; | ||
} | ||
} | ||
} | ||
|
||
function openTab(tabName) { | ||
var i, tabs; | ||
tabs = document.getElementsByClassName("tab"); | ||
for (i = 0; i < tabs.length; i++) { | ||
tabs[i].style.display = "none"; | ||
} | ||
document.getElementById(tabName).style.display = "block"; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. с отступами беда( |
||
|
||
window.onload = function() { | ||
openTab('tab1'); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,3 +45,7 @@ | |
box-sizing: border-box; | ||
border-radius: 4px; | ||
} | ||
|
||
.tab { | ||
display: none; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. пустая строка в конце файла? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
функция иногда возвращает
None
не лучше ли поднимать исключение?