generate enrollments
parent
d850b870eb
commit
28c545f310
@ -0,0 +1,17 @@
|
||||
Create a function GenerateSectionEnrollmentData in main.go that generates data for the following type:
|
||||
|
||||
```go
|
||||
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.
|
||||
|
||||
Loading…
Reference in New Issue