Skip to content

Commit

Permalink
Merge pull request #147 from 33tm/main
Browse files Browse the repository at this point in the history
New course names + '28
  • Loading branch information
33tm authored Aug 16, 2024
2 parents ba3121d + 2ac07cf commit aec165f
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 18 deletions.
2 changes: 1 addition & 1 deletion client/src/pages/settings/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function About() {
and <a href="https://github.com/ytchang05" target="_blank" rel="noopener noreferrer">Yu-Ting</a> ('23), who originally wrote the backend.{' '}
<a href="https://github.com/ImNotRog" target="_blank" rel="noopener noreferrer">Roger</a> ('24) helped immensely with Schoology integration,
as well as maintaining the backend and scripts. <a href="https://github.com/julia7hk" target="_blank" rel="noopener noreferrer">Julia</a> ('24) maintained{' '}
WATT in the 2023-24 school year, and <a href="https://github.com/33tm" target="_blank" rel="noopener noreferrer">Leo</a> ('26) is now maintaining the app.
WATT in the 2023-24 school year, and <a href="https://github.com/33tm" target="_blank" rel="noopener noreferrer">Leo</a> ('27) is now maintaining the app.
Special thanks to <a href="https://github.com/mymylie" target="_blank" rel="noopener noreferrer">Mylie</a> who designed our lovely logo.
</p>

Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/settings/Features.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function Features() {
await updateUserData('options.clock', value, auth, firestore);
}

const years = [2024, 2025, 2026, 2027, 0];
const years = [2025, 2026, 2027, 2028, 0];


return (
Expand Down
27 changes: 12 additions & 15 deletions functions/src/sgyfetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,9 @@ async function getSgyInfo(uid: string) {
}

function getClassInfo(info: string) {
const words = info.split(' ');
const pRegex = info.match(/\((.+)\)/);
let term = null;
if(pRegex) {
const parenblock = pRegex[1]; // 2696 1 FY
const items = parenblock.split(' '); // [2696, 1, FY]
term = items[items.length - 1]; // FY
}

return { pName: words[0], pTeacher: words[1], term };
// Period (#### # Course) Teacher
const [, pName, pTeacher] = info.match(/(\d) \(\d{4} \d .*\) (.*)/) || [];
return { pName, pTeacher, term: null } // course names no longer contain the semester
}

type SgyPeriodData = {n: string, c: string, l: string, o: string, s: string};
Expand All @@ -54,6 +47,7 @@ export const init = functions.https.onCall(async (data, context) => {
classes[p[0]] = { n: '', c: '', l: '', o: '', s: '' };
}

const sgyPeriods: string[] = []
const teachers: {[key: string]: [string, string]} = {};
for (const element of sgyClasses) {
let {pName, pTeacher, term} = getClassInfo(element['section_title']);
Expand All @@ -69,10 +63,7 @@ export const init = functions.https.onCall(async (data, context) => {
s: element.id
}

if (['0', '8'].includes(pName))
await firestore.collection('users').doc(uid)
.update({ [`options.period${pName}`]: true })
.catch(e => console.log(e))
sgyPeriods.push(pName)

// Zoom is deprecated

Expand All @@ -89,7 +80,13 @@ export const init = functions.https.onCall(async (data, context) => {
}

await firestore.collection('users').doc(uid)
.update({classes: classes})
.update({
classes,
options: {
period0: sgyPeriods.includes('0'),
period8: sgyPeriods.includes('8')
}
})
.catch(e => console.log(e))

return teachers;
Expand Down
76 changes: 75 additions & 1 deletion scripts/input/alternatesOverrides.json
Original file line number Diff line number Diff line change
@@ -1 +1,75 @@
{}
{
"08-15": [
{
"n": "0",
"s": 475,
"e": 530
},
{
"n": "1",
"s": 540,
"e": 615
},
{
"n": "B",
"s": 615,
"e": 620
},
{
"n": "2",
"s": 630,
"e": 700
},
{
"n": "S",
"s": 710,
"e": 740,
"grades": [
9,
10
]
},
{
"n": "Assembly",
"s": 710,
"e": 740,
"grades": [
11,
12
]
},
{
"n": "L",
"s": 740,
"e": 770
},
{
"n": "Assembly",
"s": 780,
"e": 810,
"grades": [
9,
10
]
},
{
"n": "S",
"s": 780,
"e": 810,
"grades": [
11,
12
]
},
{
"n": "3",
"s": 820,
"e": 890
},
{
"n": "4",
"s": 900,
"e": 970
}
]
}

0 comments on commit aec165f

Please sign in to comment.