From 2745ffd687ebbe06e8e1adf56e306509a765dc95 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 26 May 2024 22:57:04 +0200 Subject: [PATCH] Bug report: corrections mineures --- app/forms/main/create_bug_report.py | 4 +++- app/scodoc/sco_bug_report.py | 13 +++++++++---- app/templates/scolar/index.j2 | 5 ++++- app/views/scolar.py | 16 ++++++---------- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/app/forms/main/create_bug_report.py b/app/forms/main/create_bug_report.py index 5e354192..e94920f8 100644 --- a/app/forms/main/create_bug_report.py +++ b/app/forms/main/create_bug_report.py @@ -53,7 +53,9 @@ class CreateBugReport(FlaskForm): ) etab = StringField(label="Etablissement") include_dump = BooleanField( - "Inclure une copie anonymisée de la base de données ? (ces données permettent aux développeur·euse·s de reproduire l'erreur rencontrée)", + """Inclure une copie anonymisée de la base de données ? + Ces données faciliteront le traitement du problème et resteront strictement confidentielles. + """, default=False, ) submit = SubmitField("Envoyer") diff --git a/app/scodoc/sco_bug_report.py b/app/scodoc/sco_bug_report.py index 3c4fdee0..c7df1a11 100644 --- a/app/scodoc/sco_bug_report.py +++ b/app/scodoc/sco_bug_report.py @@ -36,18 +36,22 @@ Le principe est le suivant: informations fournies par l'utilisateur + quelques métadonnées. """ - -import app.scodoc.sco_utils as scu, sco_version, requests from flask import g from flask_login import current_user +import requests + +import app.scodoc.sco_utils as scu +import sco_version + from app import log -from app.scodoc.sco_exceptions import ScoValueError from app.scodoc.sco_dump_db import sco_dump_and_send_db +from app.scodoc.sco_exceptions import ScoValueError def sco_bug_report( title: str = "", message: str = "", etab: str = "", include_dump: bool = False ) -> requests.Response: + """Envoi d'un bug report (ticket)""" dump_id = None if include_dump: @@ -56,8 +60,9 @@ def sco_bug_report( try: dump_id = dump.json()["dump_id"] except (requests.exceptions.JSONDecodeError, KeyError): - dump_id = "inconnu" + dump_id = "inconnu (erreur)" + log(f"sco_bug_report: {scu.SCO_BUG_REPORT_URL} by {current_user.user_name}") try: r = requests.post( scu.SCO_BUG_REPORT_URL, diff --git a/app/templates/scolar/index.j2 b/app/templates/scolar/index.j2 index 21d67fe8..2c3584a5 100644 --- a/app/templates/scolar/index.j2 +++ b/app/templates/scolar/index.j2 @@ -297,7 +297,10 @@ div.effectif { rel="noopener noreferrer">Contact (Discord)
  • - Créer un ticket + Envoyer données +
  • +
  • + Signaler une erreur ou suggérer une amélioration
  • diff --git a/app/views/scolar.py b/app/views/scolar.py index b9953863..0cb128ae 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -2571,7 +2571,7 @@ def sco_bug_report_form(): form = CreateBugReport() if request.method == "POST" and form.cancel.data: # cancel button - return redirect(url_for("scodoc.index")) + return flask.redirect(url_for("scodoc.index")) if form.validate_on_submit(): r = sco_bug_report.sco_bug_report( form.title.data, form.message.data, form.etab.data, form.include_dump.data @@ -2581,15 +2581,11 @@ def sco_bug_report_form(): try: r_msg = r.json()["message"] except (requests.exceptions.JSONDecodeError, KeyError): - r_msg = ( - "Erreur: code " - + str(status_code) - + ' Merci de contacter ' - + scu.SCO_DEV_MAIL - + "" - ) + log(f"sco_bug_report: error {status_code}") + r_msg = f"""Erreur: code {status_code} + Merci de contacter + {scu.SCO_DEV_MAIL} + """ H = [html_sco_header.sco_header(page_title="Assistance technique")] if r.status_code >= 200 and r.status_code < 300: