-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update sgyfetch function on firebase functions #115
base: main
Are you sure you want to change the base?
Conversation
Visit the preview URL for this PR (updated for commit af50813): https://gunnwatt--pr115-updatefetch-ow9rs837.web.app (expires Thu, 18 Aug 2022 14:20:37 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
functions/src/sgyfetch.ts
Outdated
@@ -182,7 +187,7 @@ export const fetchMaterials = functions.https.onCall(async (data, context) => { | |||
const pages = responses[4 * i + 2].page; | |||
const events = responses[4 * i + 3].event; | |||
|
|||
sections[course.section_title.split(' ')[0][0]] = { | |||
sections[course.section_title.split(' ')[0][0] as SgyPeriod] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
sections[course.section_title.split(' ')[0][0]]
work for study hall? I'm not sure what course.section_title
looks like, but taking the first letter of the first word wouldn't work if the title were "Study Hall".
const title = sec.section_title.toLowerCase(); | ||
return (title.endsWith(YEAR_STR) && title !== YEAR_STR); | ||
}) | ||
const grad_year = ['se', 'ju', 'so', 'fr'].indexOf(gunn_student_course.section_title.slice(0,2)) + CURRENT_YEAR + 1; | ||
const grad_year = ['se', 'ju', 'so', 'fr'].indexOf(gunnStudentCourse.section_title.slice(0,2)) + CURRENT_YEAR + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better way to get graduation year via the schoology API? I recall when digging into obscure properties in people's userData
objects on firestore that some people had a gradYear
lumped into their schoology data. Is there a way we could fetch this instead of the gunn student course?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but it would require a separate fetch to /users/me, and iirc the gradYear is also off by one year for no reason at all. Might just be better to just parse courses instead.
No description provided.