@@ -223,17 +223,39 @@ def format_wizards_schedule(agenda):
223
223
return msg
224
224
225
225
async 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
+
226
244
_ , pycamp = get_active_pycamp ()
227
245
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 )
229
250
msg = format_wizards_schedule (agenda )
230
- logger .debug (msg )
231
251
232
252
await context .bot .send_message (
233
253
chat_id = update .message .chat_id ,
234
254
text = msg ,
235
255
parse_mode = "MarkdownV2"
236
256
)
257
+ logger .debug ("Wizards schedule delivered to {}" .format (update .message .from_user .username ))
258
+
237
259
238
260
239
261
def set_handlers (application ):
0 commit comments