New option to delist login from main list

This commit is contained in:
nemunaire 2022-08-15 10:35:38 +02:00
parent 45aef0b637
commit 303d748029
1 changed files with 16 additions and 0 deletions

16
main.go
View File

@ -16,6 +16,7 @@ import (
"time"
)
var gdprExceptions arrayFlags
var students [][]string
var rendusDir string
var title string
@ -140,6 +141,11 @@ func genStudents() map[string]map[string]*Submission {
for _, student := range students {
login := student[2]
if gdprExceptions.Contains(login) {
continue
}
ret[login] = genStudent(login)
}
@ -246,11 +252,21 @@ func (i *arrayFlags) Set(value string) error {
return nil
}
func (i *arrayFlags) Contains(value string) bool {
for _, v := range *i {
if v == value {
return true
}
}
return false
}
func main() {
var studentsFiles arrayFlags
var bind = flag.String("bind", "0.0.0.0:8081", "Bind port/socket")
flag.Var(&studentsFiles, "students", "Path to a CSV file containing in the third column the name of the directory to look for (can be repeated multiple times)")
flag.Var(&gdprExceptions, "gdpr-exception", "Login that should not be listed in global rendus.json (can be repeated multiple times)")
flag.StringVar(&rendusDir, "path", "./rendu/", "Path to the submissions directory (each subdirectory is a project)")
flag.StringVar(&title, "title", "Rendus VIRLI", "Title of the page")
flag.Parse()