Doodle: everyone has voted, but is the meeting booked?
Doodle helps groups agree on a meeting time. The organizer proposes a few slots, participants say which work well, which they could manage and which they cannot attend, and the organizer books one time.
Break down the problem and try your own design and implementation first. Then explore the reasoning to check states, edge cases, trade-offs, and ways to test your approach. The guide offers a reasoning path, not a complete implementation.
When a poll closes, who should hear about the booking?
Build a local scheduling notification module. The organizer invited Ari, Bo and Cy to choose between Tuesday and Thursday. Everyone who submitted a complete response receives the final time, even if neither slot worked for them. Someone who was invited but has not responded receives nothing. Each notification is a pair containing the recipient and the booked slot.
- Accept a participant’s complete response for both slots (yes, if need be, or no) and the organizer’s booking request. Before booking, a new response from the same person replaces their previous one. On the first booking, return the notifications to be sent and remember the selected slot. Reject new responses after booking. Another booking request must neither change the time nor produce any new notifications. Operations arrive one at a time, all names and slots are valid, and notification order does not matter.
- Ari says yes to both, then changes their answer to Thursday only. Bo says no to both. Cy has not responded. The organizer books Tuesday. Return exactly one notification each for Ari and Bo, both naming Tuesday. Reject a subsequent response from Cy. A request to book Thursday now returns an empty collection of notifications, and a query for the booked slot still returns Tuesday.
- Deliver a runnable module in a language of your choice and the calls that exercise this sequence. Return notifications in place of sending real email. Explain how your code distinguishes responding from being available, and which operation is allowed to trigger notifications.
Explore the reasoning
Consider Bo and Cy. Neither will attend on Tuesday, yet the system must do different things for them. Trace the two booking requests and ask what information the module must retain to decide what to return the second time.