Skip to content

Commit 8e09b66

Browse files
Merge pull request #409 from OSLL/dev
Dev to master
2 parents 63eaaaa + 33d3b35 commit 8e09b66

File tree

5 files changed

+54
-8
lines changed

5 files changed

+54
-8
lines changed

app/feedback_evaluator.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,25 @@ class PredefenceEightToTenMinutesNoSlideCheckFeedbackEvaluator(FeedbackEvaluator
152152
FEEDBACK_EVALUATOR_ID = 6
153153

154154
def __init__(self, weights=None):
155+
self.ssd_criterion = None
155156
if weights is None:
156157
weights = {
157-
"PredefenceStrictSpeechDurationCriterion": 0.6,
158+
"StrictSpeechDurationCriterion": 0.6,
158159
"DEFAULT_SPEECH_PACE_CRITERION": 0.2,
159160
"DEFAULT_FILLERS_NUMBER_CRITERION": 0.2,
160161
}
161162

162163
super().__init__(name=PredefenceEightToTenMinutesNoSlideCheckFeedbackEvaluator.CLASS_NAME, weights=weights)
163164

165+
def find_strict_speech_duration_criterion(self, criteria_keys, suffix='StrictSpeechDurationCriterion'):
166+
for criteria in criteria_keys:
167+
if suffix in criteria:
168+
return criteria
169+
164170
def evaluate_feedback(self, criteria_results):
165-
if not criteria_results.get("PredefenceStrictSpeechDurationCriterion") or \
166-
criteria_results["PredefenceStrictSpeechDurationCriterion"].result == 0:
171+
self.ssd_criterion = self.find_strict_speech_duration_criterion(criteria_results.keys())
172+
if not criteria_results.get(self.ssd_criterion) or \
173+
criteria_results[self.ssd_criterion].result == 0:
167174
return Feedback(0)
168175
if not criteria_results.get("DEFAULT_SPEECH_PACE_CRITERION") or \
169176
criteria_results["DEFAULT_SPEECH_PACE_CRITERION"].result == 0:
@@ -172,7 +179,7 @@ def evaluate_feedback(self, criteria_results):
172179

173180
def get_result_as_sum_str(self, criteria_results):
174181
if criteria_results is None or self.weights is None or \
175-
criteria_results.get("PredefenceStrictSpeechDurationCriterion", {}).get('result', 0) == 0 or \
182+
criteria_results.get(self.ssd_criterion, {}).get('result', 0) == 0 or \
176183
criteria_results.get("DEFAULT_SPEECH_PACE_CRITERION", {}).get('result', 0) == 0:
177184
return None
178185
return super().get_result_as_sum_str(criteria_results)

app/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ <h1>{{ page_title }}</h1>
1414
</div>
1515
</div>
1616
{% block content %} {% endblock %}
17-
{% include "bug_reports.html" %}
17+
<!--{% include "bug_reports.html" %}-->
1818
{% block footer %} {% include "footer.html" %} {% endblock %}
1919
<script src="{{ url_for('static', filename='js/base.js') }}"></script>
2020
</body>

app/templates/intro_page.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{# Accepts: header dependicies #}
2+
3+
{% extends "base.html" %}
4+
5+
{% block title %}Главная страница{% endblock %}
6+
7+
{% block content %}
8+
<div style="display: flex; flex-direction: column; min-height: 90vh;">
9+
<div class="holder row justify-content-center" style="flex: 1;">
10+
<div class="col-11 col-sm-8 col-md-5 col-lg-4 col-xl-3 my-auto">
11+
<h2 class="text-center ins" id="greeting">Добро пожаловать в Web Speech Trainer</h2>
12+
<div class="text-center">
13+
<p>Для использования системы вам необходимо перейти из курса на
14+
<br><b><a href="https://e.moevm.info">https://e.moevm.info/</a> </br>
15+
</p>
16+
</div>
17+
</div>
18+
</div>
19+
<div style="text-align: center; margin-top: auto; ">
20+
<p>Если вы обнаружили ошибку, пожалуйста,
21+
<a href='{{ config["BUG_REPORT_FORM"] }}'>сообщите сюда</a>
22+
<br>Адрес поддержки: {{ config['BUG_REPORT_MAIL'] }}
23+
</p>
24+
</div>
25+
</div>
26+
{% endblock %}

app/web_speech_trainer.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22
import sys
33

4-
from flask import Flask, session
4+
from flask import Flask, session, render_template
55

66
from app.api.audio import api_audio
77
from app.api.criteria import api_criteria
@@ -86,6 +86,12 @@ def resubmit_failed_trainings():
8686
TrainingManager().add_training(current_training.pk)
8787

8888

89+
@app.route('/', methods=['GET'])
90+
def index():
91+
return render_template('intro_page.html')
92+
93+
94+
8995
@app.route('/init/', methods=['GET'])
9096
def init():
9197
"""
@@ -140,7 +146,10 @@ def setupLocales(locale: str, default: str = "ru"):
140146
app.logger.propagate = False
141147
app.wsgi_app = ReverseProxied(app.wsgi_app)
142148
app.secret_key = Config.c.constants.app_secret_key
143-
149+
150+
app.config['BUG_REPORT_FORM'] = Config.c.bugreport.form_link
151+
app.config['BUG_REPORT_MAIL'] = Config.c.bugreport.report_mail
152+
144153
# check correct criterions
145154
if not check_criterions(CRITERIONS):
146155
logging.critical("Criterion's checking failed! See traceback")

app_conf/config.ini

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@ chrome=89
2525
firefox=87
2626

2727
[locale]
28-
language=ru
28+
language=ru
29+
30+
[bugreport]
31+
form_link=https://docs.google.com/forms/d/e/1FAIpQLScUudcDPUwtTvmN_sbeljicHYhubK7pPQIM1o8Wh54HstT2BQ/viewform?usp=sf_link
32+

0 commit comments

Comments
 (0)