From ec66af66892d02a5a4682cff12fed782dab9798e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Delfino?= Date: Thu, 20 Feb 2025 20:31:02 -0300 Subject: [PATCH] Use names when showing difficulty levels --- src/pycamp_bot/commands/projects.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/pycamp_bot/commands/projects.py b/src/pycamp_bot/commands/projects.py index 035f508..246b9db 100644 --- a/src/pycamp_bot/commands/projects.py +++ b/src/pycamp_bot/commands/projects.py @@ -11,6 +11,11 @@ current_projects = {} NOMBRE, DIFICULTAD, TOPIC = ["nombre", "dificultad", "topic"] +DIFFICULTY_LEVEL_NAMES = { + 1: 'inicial', + 2: 'intermedio', + 3: 'avanzado', +} logger = logging.getLogger(__name__) @@ -70,10 +75,10 @@ async def naming_project(update, context): ) await context.bot.send_message( chat_id=update.message.chat_id, - text="""Cual es el nivel de dificultad? - 1 = newbie friendly - 2 = intermedio - 3 = python avanzado""" + text=f"""Cual es el nivel de dificultad? + 1 = {DIFFICULTY_LEVEL_NAMES[1]} + 2 = {DIFFICULTY_LEVEL_NAMES[2]} + 3 = {DIFFICULTY_LEVEL_NAMES[3]}""" ) return DIFICULTAD @@ -240,7 +245,7 @@ async def show_projects(update, context): project.name, project.owner.username, project.topic, - project.difficult_level + DIFFICULTY_LEVEL_NAMES[project.difficult_level] ) participants_count = Vote.select().where( (Vote.project == project) & (Vote.interest)).count()