generate some balanced stage assignments for sections

master
Joshua Herring 2 weeks ago
parent 39580bfdb8
commit dbaed5d10b

@ -608,15 +608,23 @@ func GenerateSectionData(config Config, users []User) []Section {
now.AddDate(0, 1, 0).Format("Monday 2 January 2006"),
}
stage_types := []any{"prelim", "name", "pass_fail"}
stage_weights := []float32{80,10,10}
sections := make([]Section, config.NumberOfSections)
for i := range sections {
mystage, e := gofakeit.Weighted(stage_types, stage_weights)
if e != nil {
log.Fatalf("Error generating a stage: %s\n", e)
}
my_section := course_information[rand.Intn(len(course_information))]
my_section.SectionID = sectionIDs[i]
my_section.Instructor = instructorUIDs[rand.Intn(len(instructorUIDs))]
my_section.CourseType = "default"
my_section.GradesDue = dueDates[rand.Intn(len(dueDates))]
my_section.Stage = "prelim"
my_section.Stage = mystage.(string)
sections[i] = my_section
}

Loading…
Cancel
Save