Back

Version 10

1/27/2025
import { email } from "https://esm.town/v/std/email";

export default async function(interval: Interval) {
const course = "AFRI 0370";
const term = "202420";
const unavailableTimes = [
"MWF 10-10:50a",
"TTh 10:30-11:50a",
];

const response = await fetch("https://cab.brown.edu/api/?page=fose&route=details", {
method: "POST",
body: JSON.stringify({
group: `code:${course}`,
srcdb: term,
}),
});

const data = await response.json();
const sections: any[] = data.allInGroup;

const openSections = sections
.filter(section => !unavailableTimes.includes(section.meets))
.filter(section => section.stat !== "F");

console.log("Open sections:", openSections);

if (openSections.length > 0) {
await email({
subject: `Spots available in Linear Algebra`,
text: openSections
.map(section => `${section.meets}: https://cab.brown.edu/?kw=${section.crn}`)
.join("\n"),
});
}
}
Updated: January 28, 2025