1313import logging
1414import re
1515import time
16- from datetime import datetime , date
16+ from datetime import datetime , date , timedelta
1717
1818from slack_bolt import App
1919from slack_sdk import WebClient
@@ -415,6 +415,8 @@ def handle_create_survey(ack, body, client: WebClient, action):
415415 )
416416
417417 season_emojis = _season_emojis (session .term )
418+ term_start_friendly = _friendly_date (session .term_start )
419+ deadline = _friday_before (session .term_start )
418420
419421 survey_blocks = [
420422 {
@@ -426,19 +428,38 @@ def handle_create_survey(ack, body, client: WebClient, action):
426428 "text" : {
427429 "type" : "mrkdwn" ,
428430 "text" : (
429- f"It's time to schedule meetings for *{ session .term } *!{ season_emojis } \n \n "
430- f"Please fill out this When2Meet with your availability "
431- f"(weekdays, 9 AM - 5 PM ET):\n \n "
431+ f"Hey @channel!{ season_emojis } \n \n "
432+ f"I'd like to nail down our meeting times for the upcoming "
433+ f"*{ session .term } * term! Please fill out your availability "
434+ f"for weekly meetings (lab meetings + project meetings):\n \n "
432435 f"*<{ url } |Fill out When2Meet>*\n \n "
436+ f"Regular meetings will start up again on *{ term_start_friendly } * "
437+ f"(i.e., on the first day of the term).\n \n "
433438 f"Here's the list of our weekly meetings for this term:\n \n "
434439 f"{ project_list_text } \n \n "
435- f"Please react to this message with the appropriate emoji(s) "
436- f"for meetings you want to attend. "
437440 f"If you'd like a recurring individual meeting with me, "
438441 f"react with :zoom:\n \n "
439- f"Use your *first name and last initial* on When2Meet so "
440- f"we can match you. "
441- f"Please complete this by end of day Friday."
442+ f"In addition to filling out your availability, please react to "
443+ f"this message with the appropriate emoji(s) corresponding to "
444+ f"meetings you want to attend (note: everyone should be at the "
445+ f"full-lab meetings if at all possible; adding your reaction helps "
446+ f"me gauge who is active in the lab this term). I'll use your "
447+ f"responses to figure out times that accommodate as many people as "
448+ f"possible. Everything will go on the CDL calendar, and anyone is "
449+ f"welcome at any of the project meetings if you're interested in "
450+ f"learning more, even if it's not for your primary project(s). "
451+ f"The lab's policy is: anyone can work on any project they are "
452+ f"interested in. So if you're new to the group, feel free to "
453+ f"explore!\n \n "
454+ f"All group meetings will be hybrid: in person (Moore 416) and "
455+ f"via Zoom (<https://dartmouth.zoom.us/my/contextlab|link>). "
456+ f"Individual meetings will be in my office (Moore 349) or via "
457+ f"the same Zoom link.\n \n "
458+ f"Please use your *first name and last initial* on When2Meet so "
459+ f"we can match you. Fill out your availability + add your emoji "
460+ f"reactions by *end of day { deadline } *. "
461+ f"(If you don't fill it out by then, your preferences won't be "
462+ f"taken into account for scheduling.)"
442463 ),
443464 },
444465 },
@@ -1793,3 +1814,28 @@ def _create_calendar_events(client: WebClient, session, schedule_df) -> str:
17931814 except Exception as e :
17941815 logger .error (f"Error creating calendar events: { e } " )
17951816 return f":warning: Calendar event creation failed: { e } "
1817+
1818+
1819+ def _friendly_date (iso_date : str ) -> str :
1820+ """Convert "2026-03-30" to "Monday, March 30"."""
1821+ try :
1822+ d = date .fromisoformat (iso_date )
1823+ return d .strftime ("%A, %B %-d" )
1824+ except (ValueError , TypeError ):
1825+ return iso_date
1826+
1827+
1828+ def _friday_before (iso_date : str ) -> str :
1829+ """
1830+ Find the Friday before a term start date.
1831+ Returns a friendly string like "Friday, March 27".
1832+ """
1833+ try :
1834+ d = date .fromisoformat (iso_date )
1835+ # Find the Friday before (or on) the day before term starts
1836+ day_before = d - timedelta (days = 1 )
1837+ days_since_friday = (day_before .weekday () - 4 ) % 7
1838+ friday = day_before - timedelta (days = days_since_friday )
1839+ return friday .strftime ("Friday, %B %-d" )
1840+ except (ValueError , TypeError ):
1841+ return "Friday before the term starts"
0 commit comments