swecc-uw / swecc-client

Client for SWECC's mock interview, mentorship and other services.
https://interview.swecc.org
0 stars 3 forks source link

Automatically suggest times in common for partners #11

Open elimelt opened 7 months ago

elimelt commented 7 months ago

This might look like an expandable list of times next to every pairing entry.

Conveniently, we are already storing everything needed to add this as a feature! Availabilities are currently stored as a JSON array of 1s and 0s for each hour of the week. For example...

avail = [
   [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, ...],   // Sunday
   [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, ...],   // Monday
   [...],                                       // Tuesday
   ...                                          // ...
]

means that whoever has availability avail is free from 6am-7am on Sunday, corresponding to avail[0][6], and 3am-4am on Monday, corresponding to avail[1][3] (early bird gets the worm).

So to implement this feature, you need to get the form_id of a given signup (it makes sense to only show this for the form actively being interviewed on, so check out services/form.ts:getActiveInterviewFormID), and then get the user's pairing for this form. Once you have both of the pair members' user_ids, find their signup for the form_id, which contains their availabilities.