Skip to content
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

Reduce duplicated code in description, requisite fetching #5

Open
ninest opened this issue Jul 30, 2022 · 0 comments
Open

Reduce duplicated code in description, requisite fetching #5

ninest opened this issue Jul 30, 2022 · 0 comments
Assignees

Comments

@ninest
Copy link
Owner

ninest commented Jul 30, 2022

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")

@ninest ninest self-assigned this Jul 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant