Skip to content

Reduce duplicated code in description, requisite fetching #5

@ninest

Description

@ninest

The code for fetching descriptions and co-requisites looks quite similar: looping through subjects, then courses, fetching something, merging it with the courses, and saving it to the file.

Create a function that does the looping for us and only requires a definition of what should happen to each course.

For example (fetching descriptions):

augmentCourses({
  // subjects (optional): { code: "CS" }, use for debugging
  name: "description" // for logging
  action: (subject, course, index) => {
    const description = await fetchDescription(course.term, course.crn);
  },
});

The name field is for logging ("1/151: 3/4 descriptions fetched")

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions