Skip to content
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

Dev to master #409

Merged
merged 4 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions app/feedback_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,25 @@ class PredefenceEightToTenMinutesNoSlideCheckFeedbackEvaluator(FeedbackEvaluator
FEEDBACK_EVALUATOR_ID = 6

def __init__(self, weights=None):
self.ssd_criterion = None
if weights is None:
weights = {
"PredefenceStrictSpeechDurationCriterion": 0.6,
"StrictSpeechDurationCriterion": 0.6,
"DEFAULT_SPEECH_PACE_CRITERION": 0.2,
"DEFAULT_FILLERS_NUMBER_CRITERION": 0.2,
}

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

def find_strict_speech_duration_criterion(self, criteria_keys, suffix='StrictSpeechDurationCriterion'):
for criteria in criteria_keys:
if suffix in criteria:
return criteria

def evaluate_feedback(self, criteria_results):
if not criteria_results.get("PredefenceStrictSpeechDurationCriterion") or \
criteria_results["PredefenceStrictSpeechDurationCriterion"].result == 0:
self.ssd_criterion = self.find_strict_speech_duration_criterion(criteria_results.keys())
if not criteria_results.get(self.ssd_criterion) or \
criteria_results[self.ssd_criterion].result == 0:
return Feedback(0)
if not criteria_results.get("DEFAULT_SPEECH_PACE_CRITERION") or \
criteria_results["DEFAULT_SPEECH_PACE_CRITERION"].result == 0:
Expand All @@ -172,7 +179,7 @@ def evaluate_feedback(self, criteria_results):

def get_result_as_sum_str(self, criteria_results):
if criteria_results is None or self.weights is None or \
criteria_results.get("PredefenceStrictSpeechDurationCriterion", {}).get('result', 0) == 0 or \
criteria_results.get(self.ssd_criterion, {}).get('result', 0) == 0 or \
criteria_results.get("DEFAULT_SPEECH_PACE_CRITERION", {}).get('result', 0) == 0:
return None
return super().get_result_as_sum_str(criteria_results)
Expand Down
2 changes: 1 addition & 1 deletion app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1>{{ page_title }}</h1>
</div>
</div>
{% block content %} {% endblock %}
{% include "bug_reports.html" %}
<!--{% include "bug_reports.html" %}-->
{% block footer %} {% include "footer.html" %} {% endblock %}
<script src="{{ url_for('static', filename='js/base.js') }}"></script>
</body>
Expand Down
26 changes: 26 additions & 0 deletions app/templates/intro_page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{# Accepts: header dependicies #}

{% extends "base.html" %}

{% block title %}Главная страница{% endblock %}

{% block content %}
<div style="display: flex; flex-direction: column; min-height: 90vh;">
<div class="holder row justify-content-center" style="flex: 1;">
<div class="col-11 col-sm-8 col-md-5 col-lg-4 col-xl-3 my-auto">
<h2 class="text-center ins" id="greeting">Добро пожаловать в Web Speech Trainer</h2>
<div class="text-center">
<p>Для использования системы вам необходимо перейти из курса на
<br><b><a href="https://e.moevm.info">https://e.moevm.info/</a> </br>
</p>
</div>
</div>
</div>
<div style="text-align: center; margin-top: auto; ">
<p>Если вы обнаружили ошибку, пожалуйста,
<a href='{{ config["BUG_REPORT_FORM"] }}'>сообщите сюда</a>
<br>Адрес поддержки: {{ config['BUG_REPORT_MAIL'] }}
</p>
</div>
</div>
{% endblock %}
13 changes: 11 additions & 2 deletions app/web_speech_trainer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import sys

from flask import Flask, session
from flask import Flask, session, render_template

from app.api.audio import api_audio
from app.api.criteria import api_criteria
Expand Down Expand Up @@ -86,6 +86,12 @@ def resubmit_failed_trainings():
TrainingManager().add_training(current_training.pk)


@app.route('/', methods=['GET'])
def index():
return render_template('intro_page.html')



@app.route('/init/', methods=['GET'])
def init():
"""
Expand Down Expand Up @@ -140,7 +146,10 @@ def setupLocales(locale: str, default: str = "ru"):
app.logger.propagate = False
app.wsgi_app = ReverseProxied(app.wsgi_app)
app.secret_key = Config.c.constants.app_secret_key


app.config['BUG_REPORT_FORM'] = Config.c.bugreport.form_link
app.config['BUG_REPORT_MAIL'] = Config.c.bugreport.report_mail

# check correct criterions
if not check_criterions(CRITERIONS):
logging.critical("Criterion's checking failed! See traceback")
Expand Down
6 changes: 5 additions & 1 deletion app_conf/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ chrome=89
firefox=87

[locale]
language=ru
language=ru

[bugreport]
form_link=https://docs.google.com/forms/d/e/1FAIpQLScUudcDPUwtTvmN_sbeljicHYhubK7pPQIM1o8Wh54HstT2BQ/viewform?usp=sf_link
[email protected]
Loading