From 15e6d45a7d7be6c1e366c76eeac4c4cda6bc9f0e Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov Date: Sun, 8 Sep 2024 23:50:17 +0300 Subject: [PATCH 1/4] add intro_page and update bug report logic --- app/templates/base.html | 2 +- app/templates/intro_page.html | 26 ++++++++++++++++++++++++++ app/web_speech_trainer.py | 13 +++++++++++-- app_conf/config.ini | 6 +++++- 4 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 app/templates/intro_page.html diff --git a/app/templates/base.html b/app/templates/base.html index d68b3a08..f09ef976 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -14,7 +14,7 @@

{{ page_title }}

{% block content %} {% endblock %} - {% include "bug_reports.html" %} + {% block footer %} {% include "footer.html" %} {% endblock %} diff --git a/app/templates/intro_page.html b/app/templates/intro_page.html new file mode 100644 index 00000000..b50f9299 --- /dev/null +++ b/app/templates/intro_page.html @@ -0,0 +1,26 @@ +{# Accepts: header dependicies #} + +{% extends "base.html" %} + +{% block title %}Главная страница{% endblock %} + +{% block content %} +
+
+
+

Добро пожаловать в Web Speech Trainer

+
+

Для использования системы вам необходимо перейти из курса на +
https://e.moevm.info/
+

+
+
+
+
+

Если вы обнаружили ошибку, пожалуйста, + сообщите сюда +
Адрес поддержки: {{ config['BUG_REPORT_MAIL'] }} +

+
+
+{% endblock %} \ No newline at end of file diff --git a/app/web_speech_trainer.py b/app/web_speech_trainer.py index 21a2699a..37758e8c 100644 --- a/app/web_speech_trainer.py +++ b/app/web_speech_trainer.py @@ -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 @@ -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(): """ @@ -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") diff --git a/app_conf/config.ini b/app_conf/config.ini index ea8a20e3..2d2bd04f 100644 --- a/app_conf/config.ini +++ b/app_conf/config.ini @@ -25,4 +25,8 @@ chrome=89 firefox=87 [locale] -language=ru \ No newline at end of file +language=ru + +[bugreport] +form_link= +report_mail= \ No newline at end of file From f709a6781756f1bf8664d72ba70bbf191f6dbbcf Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov Date: Sun, 8 Sep 2024 23:52:31 +0300 Subject: [PATCH 2/4] set current bug vars --- app_conf/config.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app_conf/config.ini b/app_conf/config.ini index 2d2bd04f..5264018f 100644 --- a/app_conf/config.ini +++ b/app_conf/config.ini @@ -28,5 +28,5 @@ firefox=87 language=ru [bugreport] -form_link= -report_mail= \ No newline at end of file +form_link=https://docs.google.com/forms/d/e/1FAIpQLScUudcDPUwtTvmN_sbeljicHYhubK7pPQIM1o8Wh54HstT2BQ/viewform?usp=sf_link +report_mail=support@moevm.info \ No newline at end of file From 909ad12909109c46faa544352ef8d9b0f74e1dee Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov Date: Mon, 30 Sep 2024 13:32:15 +0300 Subject: [PATCH 3/4] Update FEEDBACK_EVALUATOR_ID = 6 --- app/feedback_evaluator.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/app/feedback_evaluator.py b/app/feedback_evaluator.py index d29050c9..ed1f180d 100644 --- a/app/feedback_evaluator.py +++ b/app/feedback_evaluator.py @@ -152,18 +152,29 @@ 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: + ssd_criterion = self.find_strict_speech_duration_criterion(criteria_results.keys()) + if ssd_criterion: + # replace critetion weights + self.weights[ssd_criterion] = self.weights.pop('StrictSpeechDurationCriterion') + self.ssd_criterion = ssd_criterion + 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: @@ -172,7 +183,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) From 33d3b35f1cee2acc4da252de5a066fa5bef0e3f5 Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov Date: Mon, 30 Sep 2024 14:57:42 +0300 Subject: [PATCH 4/4] Update evaluate_feedback --- app/feedback_evaluator.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/feedback_evaluator.py b/app/feedback_evaluator.py index ed1f180d..ca2a31c1 100644 --- a/app/feedback_evaluator.py +++ b/app/feedback_evaluator.py @@ -168,11 +168,7 @@ def find_strict_speech_duration_criterion(self, criteria_keys, suffix='StrictSpe return criteria def evaluate_feedback(self, criteria_results): - ssd_criterion = self.find_strict_speech_duration_criterion(criteria_results.keys()) - if ssd_criterion: - # replace critetion weights - self.weights[ssd_criterion] = self.weights.pop('StrictSpeechDurationCriterion') - self.ssd_criterion = ssd_criterion + 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)