LCOGT / lco-education-platform

LCO's education platform for students and teachers
0 stars 0 forks source link

Fix/schedule flow #72

Closed capetillo closed 6 days ago

capetillo commented 2 weeks ago

FIX: SCHEDULE FLOW

First, thank you for your patience. It has been a very tumultuous time and lots of bugs to debug. Second, here's my PR.

NOTE ON NUMBER OF FILES CHANGED:

Alright, now to the PR

STORE CHANGES sessions store

Screenshot 2024-10-23 at 5 29 17 PM

SCHEDULING CHANGES First, here's a video to better demonstrate both of the flows

Beginner scheduling view

https://github.com/user-attachments/assets/dae9a927-36c3-418a-97ae-efd05cdfab70

In the beginner view, the user starts first by selecting a date range. This date range is used to make an api request to whats up in the sky to get a list of all available targets (in N and S hemispheres) as well as recommended exposures associated with each target. The targets are sorted based on the object it corresponds to (e.g. M100 would go under galaxy) and only the first 3 targets are sorted and displayed. I can change this, but for now, we're only showing 3. The user then selects the desired target and if I'm ok with defaults is selected, then the selected target along with the recommended exposure settings are what's requested to the /requestgroups endpoint. Alternatively, the user can select Let me choose and the component SchedulingSettings renders. This component will not render the project name, target, ra, dec fields that you see in AdvancedScheduling because the props passed to the SchedulingSettings component.

Advanced scheduling view

https://github.com/user-attachments/assets/c5359c49-28c9-46a6-b5d4-7c7e3c3dbb10

Now in the advanced view, the SchedulingSettings renders entirely. The difference here is that fields are disabled and they become enabled as the user fills them out. For target, the ra and dec get auto populated by making a request to simbad2k. Then once a valid target is selected, the rest of the fields are enabled.

Both components (Advanced and Beginner) pass the selections through emits to the parent component, Scheduling View. It is here that the POST request to /requestgroups happens. If there is only one target, the value for operator is SINGLE. And if there is more than one target, the value is MANY. The requests get populated based on how many targets there are and each target is its own request (plus configuration) In more detail:

UPDATED FIXES:

Renamed consts, changed some hardcoded values, added more comments, added magic numbers, but the biggest change was splitting the sessions store (now called realTimeSessions). There are now two stores: realTimeSessions and obsPortalData. The former handles tokens for rt sessions, the current session's id, current session. The latter handles any completed observations (to display thumbnails), upcoming real time sessions, and pending request groups. The reason why upcoming real time sessions is handled here is because the action fetchCompleteObservationsAndUpcomingRTSessions sorts these two since it's the same api request.