Fix exec fetching and add events (#491)
continuous-integration/drone/push Build is passing Details

- Fixed edge case with fetching execs
- Added Bootcamp mentor application news, and CSC x Google event

**Problem:** When building the Meet the Team page using LDAP (in CI), we were only checking CSC members for the "current" term (Fall 2022) to see if any of them were execs. Since our actual current execs (the Spring 2022 execs, since Fall 2022 elections have not occurred yet) have not renewed their memberships for Fall 2022, the script was unable to find individuals for the Prez/VP/AVP/Trez positions, which caused an error.

**Solution:**
1. Gracefully handle the edge case where an exec position might be intentionally unfilled, by simply omitting it from the Meet the Team page.
2. Search through CSC members for both the current term and the previous term, when checking for execs. Note that this might make the build time slightly slower, since the script now needs to loop through two terms of members in order to pick out the execs, however the difference should be insignificant.

Co-authored-by: Amy <a258wang@uwaterloo.ca>
Reviewed-on: #491
Reviewed-by: j285he <j285he@localhost>
This commit is contained in:
Amy Wang 2022-09-02 14:34:02 -04:00
parent f5072d38fd
commit 94156adfd2
5 changed files with 74 additions and 23 deletions

View File

@ -0,0 +1,17 @@
---
name: 'CSC x Google: Life of a SWE + Q&A'
short: "Join us as Googlers share day-in-the-life stories about their work and provide an inside look on what makes engineering at Google unique."
startDate: 'September 13 2022 18:00'
endDate: 'September 13 2022 19:30'
online: false
location: 'AHS EXP 1689'
poster: 'images/events/2022/fall/Google-Life-of-a-SWE.jpeg'
registerLink: https://goo.gle/3AKSOR6
---
📣 Interested in learning what is it like to be a software engineer at Google? Join us as Googlers share day-in-the-life stories about their work and provide an inside look on what makes engineering at Google unique.
👀 RSVP with the following link to confirm your spot: https://goo.gle/3AKSOR6
🗓️ Event Date: Tuesday September 13th from 6:00 PM - 7:30 PM ET
We are looking forward to connecting Google with the UWaterloo community! 🎉

View File

@ -0,0 +1,18 @@
---
author: 'a258wang'
date: 'September 1 2022 00:00'
---
📣 The Fall 2022 Bootcamp Event is looking for mentors to take on resume critiques, host mock interviews, and help prepare students for their co-op search! This is an awesome opportunity for anyone to give back to the Waterloo community and make an impact on a students co-op search.
📅 There is a resume review event happening on September 14th from 6:00pm-10:00 PM ET and a mock interview event on September 21st from 6:00pm-10:00 PM ET.
You can choose to participate at either event for a select number of hours!
❗️ All sessions will take place virtually on our Bootcamp Discord Server! Students will have a chance to meet with you 1 on 1 to discuss their resumes/conduct their interviews.
To sign up, please visit this link: https://bit.ly/bootcamp-mentor-signups
Alternatively, you can email us at exec@csclub.uwaterloo.ca with the year and program youre in, along with interested job paths.
📅 Deadline to Apply for Resume Reviews: September 11th, 2022, 11:59PM ET
📅 Deadline to Apply for Mock Interviews: September 18th, 2022, 11:59PM ET

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 KiB

View File

@ -5,7 +5,7 @@ import matter from "gray-matter";
import { Client } from "ldapts";
import { serialize } from "next-mdx-remote/serialize";
import { capitalize, TermYear } from "@/utils";
import { capitalize, getCurrentTermYear, getTermYear, TermYear } from "@/utils";
const EXECS_PATH = path.join("content", "team", "execs");
const FILETYPE = ".md";
@ -32,8 +32,8 @@ export interface Metadata {
image: string;
}
export async function getExecs(termYear: TermYear) {
const execNamePosPairs = await getExecNamePosPairs(termYear);
export async function getExecs() {
const execNamePosPairs = await getExecNamePosPairs();
return await Promise.all(
execNamePosPairs.map((namePosPair) =>
@ -76,10 +76,9 @@ async function getExec(name: string, pos: string) {
}
}
async function getExecNamePosPairs({
term,
year,
}: TermYear): Promise<[person: string, position: string][]> {
async function getExecNamePosPairs(): Promise<
[person: string, position: string][]
> {
if (process.env.USE_LDAP?.toLowerCase() !== "true") {
return [["codey", "mascot"]];
}
@ -94,12 +93,29 @@ async function getExecNamePosPairs({
try {
await client.bind("", "");
const terms: TermYear[] = [];
// check members from last two terms (including current term)
for (const termYear of getTermYear(getCurrentTermYear(), {
goBackwards: true,
})) {
if (terms.length >= 2) {
break;
}
terms.push(termYear);
}
const termsFilters = terms
.map(
({ term, year }: TermYear) =>
`(term=${(term as string).slice(0, 1)}${year})`
)
.join("");
const { searchEntries } = await client.search(searchDN, {
scope: "sub",
filter: `(&(objectClass=member)(term=${(term as string).slice(
0,
1
)}${year}))`,
filter: `(&(objectClass=member)(|${termsFilters}))`,
});
// item.position might be an array if the member has more than one position
@ -115,16 +131,17 @@ async function getExecNamePosPairs({
}
});
formattedExec = orderedExecPositions.map((position) => {
return [
`${execMembers[position].split(" ")[0].toLowerCase()}-${execMembers[
position
]
.split(" ")[1]
.toLowerCase()}`,
position,
];
});
formattedExec = orderedExecPositions
.map((position) => {
const fullName = execMembers[position];
if (fullName == undefined) {
return null;
}
const firstName = fullName.split(" ")[0].toLowerCase();
const lastName = fullName.split(" ")[1].toLowerCase();
return [`${firstName}-${lastName}`, position];
})
.filter((pair) => pair != null) as [person: string, position: string][];
formattedExec = [...formattedExec, ["codey", "mascot"]];
} finally {

View File

@ -14,7 +14,6 @@ import {
Metadata as TeamMemberData,
getMemberImagePath,
} from "@/lib/team";
import { getCurrentTermYear } from "@/utils";
import designData from "../../content/team/design-team.json";
import discordData from "../../content/team/discord-team.json";
@ -155,7 +154,7 @@ function sortTeamMembers(team: Team): Team {
}
export const getStaticProps: GetStaticProps<Props> = async () => {
const execs = await getExecs(getCurrentTermYear());
const execs = await getExecs();
// Note that rawTeams do not contain image paths of members, even though
// TypeScript thinks that it does. It's just to simplify some code.