docs: Translate comments and logging messages to Spanish across various modules and the scheduler.

This commit is contained in:
Marco Gallegos
2025-12-18 00:17:14 -06:00
parent ade8a5f98d
commit e960538943
16 changed files with 266 additions and 230 deletions

View File

@@ -1,45 +1,42 @@
# app/modules/equipo.py
"""
This module contains functionality for authorized team members.
# Este módulo contiene funciones para los miembros autorizados del equipo.
# Incluye un flujo para proponer actividades que el dueño debe aprobar.
It includes a conversational flow for proposing new activities that require
approval from the owner, as well as a function to check the status of
previously submitted requests.
"""
from telegram import Update
from telegram.ext import ContextTypes, ConversationHandler
# Define the states for the activity proposal conversation.
# Definimos los estados para la conversación de propuesta de actividad.
DESCRIPTION, DURATION = range(2)
async def propose_activity_start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
"""
Starts the conversation for a team member to propose a new activity.
This is typically triggered by an inline button press.
Inicia el proceso para que un miembro del equipo proponga una actividad.
Se activa cuando se pulsa el botón correspondiente.
"""
await update.callback_query.answer()
await update.callback_query.edit_message_text(
"Por favor, describe la actividad que quieres proponer."
)
# The function returns the next state, which is DESCRIPTION.
# Siguiente paso: DESCRIPTION
return DESCRIPTION
async def get_description(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
"""
Stores the activity description provided by the user and asks for the duration.
Guarda la descripción de la actividad y pide la duración.
"""
context.user_data['activity_description'] = update.message.text
await update.message.reply_text(
"Entendido. Ahora, por favor, indica la duración estimada en horas (ej. 2, 4.5)."
)
# The function returns the next state, DURATION.
# Siguiente paso: DURATION
return DURATION
async def get_duration(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
"""
Stores the activity duration, confirms the proposal to the user, and ends the conversation.
Guarda la duración, confirma la propuesta y termina la conversación.
"""
try:
# Intentamos convertir el texto a un número decimal (float)
duration = float(update.message.text)
context.user_data['activity_duration'] = duration
description = context.user_data.get('activity_description', 'N/A')
@@ -51,24 +48,22 @@ async def get_duration(update: Update, context: ContextTypes.DEFAULT_TYPE) -> in
"Recibirás una notificación cuando sea revisada."
)
# TODO: Send this proposal to the owner for approval, for example,
# by sending a webhook or saving it to a database.
# TODO: Enviar esta propuesta al dueño (por webhook o base de datos).
await update.message.reply_text(confirmation_text, parse_mode='Markdown')
# Clean up user_data to prevent data leakage into other conversations.
# Limpiamos los datos temporales
context.user_data.clear()
# End the conversation.
# Terminamos la conversación
return ConversationHandler.END
except ValueError:
# If the user provides an invalid number for the duration, ask again.
# Si el usuario no escribe un número válido, se lo pedimos de nuevo
await update.message.reply_text("Por favor, introduce un número válido para la duración en horas.")
return DURATION
async def cancel_proposal(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
"""
Cancels and ends the activity proposal conversation.
This is triggered by the /cancel command.
Cancela el proceso de propuesta si el usuario escribe /cancel.
"""
await update.message.reply_text("La propuesta de actividad ha sido cancelada.")
context.user_data.clear()
@@ -76,10 +71,9 @@ async def cancel_proposal(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
def view_requests_status():
"""
Allows a team member to see the status of their recent requests.
Currently, this returns a hardcoded sample status. In a real-world
application, this would fetch the user's requests from a database.
Permite a un miembro del equipo ver el estado de sus solicitudes recientes.
Por ahora devuelve un estado de ejemplo fijo.
"""
# TODO: Fetch the status of recent requests from a persistent data source.
# TODO: Obtener el estado real desde una base de datos.
return "Aquí está el estado de tus solicitudes recientes:\n\n- Grabación de proyecto (4h): Aprobado\n- Taller de guion (2h): Pendiente"