You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

913 B

Create a function GenerateSectionEnrollmentData in main.go that generates data for the following type:

type SectionEnrollment struct {
	SectionID string `json:"section_id"`
	UID       string `json:"uid"`
}

The function should take three arguments - users []User, sections []Section, config Config - and return a []SectionEnrollment

It should generate a list of []SectionEnrollment equal in length to the length of the users list multiplied by the config.EnrollmentsPerStudent member meeting the following requirements:

  1. Each UID in the users list should be paird with config.EnrollmentsPerStudent distinct SectionIDs from the sections list

Create another function SaveGeneratedSectionEnrollments that takes a []SectionEnrollment, converts it into csv row data and saves it to a file section_enrollments.csv, creating this file if necessary and truncating any existing such file before writing.