Skip to content

Commit fc40e80

Browse files
docs(README): discuss recurrence implementation
1 parent c8b34bf commit fc40e80

File tree

1 file changed

+52
-34
lines changed

1 file changed

+52
-34
lines changed

README.md

Lines changed: 52 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -56,56 +56,74 @@ in their `mentoring.subjects` property).
5656
An org is a school or nonprofit or other business entity that is using TB to
5757
manage their tutoring and mentoring programs.
5858

59-
### `Request`
60-
61-
A request is a job post. Typically created by parents or teachers, it comprises
62-
of:
63-
64-
- The student who needs help (e.g. "Nicholas Chiang").
65-
- When the student is available (this is included in the student's profile).
66-
- The subjects he/she needs help with (e.g. "AP Computer Science A"). This is
67-
also added to the student's profile under their `tutoring.searches` property.
68-
- A concise description of what specifically the student is struggling with
69-
(e.g. "Nicholas doesn't understand Java arrays and sorting algorithms").
70-
71-
**Note:** Requests can also be created by admins (and often are). For example,
72-
an admin might need to migrate the results of a Google Form to Tutorbook (by
73-
creating the requests all at once and then fulfilling them over time).
74-
75-
Once created, a request is fulfilled by an admin, who searches on behalf of the
76-
student and creates a match (between the student and an appropriate
77-
tutor/mentor).
78-
7959
### `Match`
8060

8161
A match is a pairing of people (typically between a single student and a single
82-
tutor/mentor, but there can be group pairings as well). Matches can specify
83-
times (e.g. "Every Monday at 3-4pm") and meeting venues (e.g. "Use this Zoom
84-
meeting room" or "Use this Google Meet link").
62+
tutor/mentor, but there can be group pairings as well). Matches are simply
63+
containers for [meetings](#meeting).
8564

8665
- Students create matches when they "send a request" to a tutor/mentor from the
8766
search view.
8867
- Admins can directly create matches (e.g. when migrating from an existing
8968
system, admins know who's matched with whom).
90-
- Admins can create matches to fulfill requests (e.g. a teacher requests help
91-
for their struggling student and the admin finds that help).
92-
93-
Upon creation, Tutorbook sends an email to everyone in the match (all of the
94-
`attendees`) with everyone's anonymous contact info.
9569

96-
Tutorbook has a system like
97-
[Craigslist's](https://www.craigslist.org/about/anonymize) where each attendee
98-
in each match has a unique anonymous email address (e.g.
99-
`[email protected]`). Emails can then be
100-
intercepted by Tutorbook and added to the in-app communications timeline before
101-
being relayed to their intended recipients.
70+
### `Meeting`
71+
72+
A meeting is exactly that: a meeting between the people in a [match](#match)
73+
with a specific time and venue (e.g. a specific Zoom link). In order to support
74+
[complex recurrence rules](#recurring-meetings), a meeting's time consists of:
75+
76+
- **Start date:** The start time of the first meeting instance.
77+
- **Duration:** The meeting's duration in milliseconds. Stored in milliseconds
78+
to match JavaScript's `Date` object precision.
79+
- **End date:** The last possible meeting end time. If a meeting is recurring,
80+
this will be the end time of the last meeting instance in that recurring
81+
range. Or, if the recurring range is infinite, we use [JavaScript's max
82+
date](https://stackoverflow.com/questions/11526504/minimum-and-maximum-date)
83+
(Fri Sep 12 275760) which is more than sufficient.
84+
- **RRULE:** The time's recurrence rule as defined in [the iCalendar
85+
RFC](https://tools.ietf.org/html/rfc5545). This is used server-side by
86+
[`rrule`](https://www.npmjs.com/package/rrule) to calculate individual
87+
meeting instances that are then sent to the client. It is manipulated
88+
client-side when users select a recurrence rule or choose to add an
89+
exception to a recurring meeting.
90+
91+
Upon creation, Tutorbook sends an email to all of the `people` in the new
92+
meeting's match with the meeting time, venue, and everyone's contact info.
10293

10394
## Design Specifications
10495

10596
Summarized here are descriptions of common data flow patterns and design specs.
10697
These are some of the front-end design guidelines that TB follows in order to
10798
maintain consistency and display predictable behavior.
10899

100+
### Recurring Meetings
101+
102+
Recurring events are always a struggle to implement. There are [many](https://stackoverflow.com/questions/85699/whats-the-best-way-to-model-recurring-events-in-a-calendar-application) [resources](https://github.com/bmoeskau/Extensible/blob/master/recurrence-overview.md) [available](https://medium.com/@ScullWM/design-and-manage-recurring-events-fb43676e711a)
103+
that are meant to make implementing such recurrence rules easier.
104+
105+
TB's entire recurrence stack is quite simple:
106+
107+
1. Meetings specify complex `RRULE` recur rules with support for event
108+
exceptions and everything else supported by [`rrule`](https://www.npmjs.com/package/rrule).
109+
2. At index time, the last possible end date is stored in our Algolia index to
110+
[make querying data more efficient](https://github.com/bmoeskau/Extensible/blob/master/recurrence-overview.md#storage-and-retrieval).
111+
3. When a meeting range is requested, our API parses the recur rules for
112+
meetings within the requested range (i.e. both the start date and recur end
113+
date are within the requested date range) and sends the client individual
114+
meeting instances.
115+
4. When availability is requested, our API again parses the recur rules for
116+
meetings within the requested availability range and excludes the resulting
117+
individual meeting instances from the user's weekly availability.
118+
119+
Editing and updating recurring meetings is intuitive:
120+
121+
- When a user updates a single event instance (choosing not to update all
122+
recurring events), an exception is added to the recurring event's `RRULE` and
123+
a new regular (i.e non-recurring) meeting is created.
124+
- When a user deletes a single event instance (choosing not to delete all
125+
recurring events), an exception is added to the recurring event's `RRULE`.
126+
109127
### Analytics
110128

111129
TB uses [Segment](https://segment.com) to collect analytics from both the client

0 commit comments

Comments
 (0)