@@ -223,17 +223,39 @@ def format_wizards_schedule(agenda):
223223 return msg
224224
225225async def show_wizards_schedule (update , context ):
226+ show_all = False
227+ parameters = update .message .text .strip ().split (' ' , 1 )
228+ if len (parameters ) == 2 :
229+ flag = parameters [1 ].strip ().lower ()
230+ show_all = (flag == "completa" )
231+ if not show_all :
232+ await context .bot .send_message (
233+ chat_id = update .message .chat_id ,
234+ text = "El comando solo acepta un parámetro (opcional): 'completa'. ¿Probás de nuevo?" ,
235+ )
236+ return
237+ elif len (parameters ) > 2 :
238+ await context .bot .send_message (
239+ chat_id = update .message .chat_id ,
240+ text = "El comando solo acepta un parámetro (opcional): 'completa'. ¿Probás de nuevo?" ,
241+ )
242+ return
243+
226244 _ , pycamp = get_active_pycamp ()
227245
228- agenda = WizardAtPycamp .select ().where (pycamp == pycamp ).order_by (WizardAtPycamp .init )
246+ agenda = WizardAtPycamp .select ().where (WizardAtPycamp .pycamp == pycamp )
247+ if not show_all :
248+ agenda = agenda .where (WizardAtPycamp .end > datetime .now ())
249+ agenda = agenda .order_by (WizardAtPycamp .init )
229250 msg = format_wizards_schedule (agenda )
230- logger .debug (msg )
231251
232252 await context .bot .send_message (
233253 chat_id = update .message .chat_id ,
234254 text = msg ,
235255 parse_mode = "MarkdownV2"
236256 )
257+ logger .debug ("Wizards schedule delivered to {}" .format (update .message .from_user .username ))
258+
237259
238260
239261def set_handlers (application ):
0 commit comments