Fix: Reading subject infos from csv file

This commit is contained in:
Bertrand Benjamin 2022-07-20 16:38:38 +02:00
parent e6595b7041
commit 5bf9d8b7c1
3 changed files with 18 additions and 6 deletions

View File

@ -1,7 +1,12 @@
EXAMPLE=simple
docker-build:
docker build -f Dockerfile.$(EXAMPLE) -t $(EXAMPLE) .
docker-build-simple:
docker build -f Dockerfile.simple -t simple .
docker-test: docker-build
docker run $(EXAMPLE) sh -c "bopytex -q 2 tpl_example.tex && cat 1_example.tex"
docker-simple: docker-build-simple
docker run simple sh -c "bopytex -q 2 tpl_example.tex && cat 1_example.tex"
docker-build-usecase:
docker build -f Dockerfile.usecase -t usecase .
docker-usecase: docker-build-usecase
docker run usecase sh -c "bopytex -s students.csv tpl_example.tex && cat 1_example.tex"

View File

@ -36,7 +36,8 @@ def planner(options: dict) -> list[Task]:
else:
with open(students_csv, "r") as csv_file:
infos = csv.DictReader(csv_file)
reader = csv.DictReader(csv_file)
infos = [r for r in reader]
options["subjects"] = build_subject_list_from_infos(infos)
return tasks_builder(options)

View File

@ -0,0 +1,6 @@
"Name","Age","Email","fraction level","calculus level"
"Spike Tucker","22","s.tucker@randatmail.com","7","3"
"Martin Payne","21","m.payne@randatmail.com","7","3"
"Kimberly Baker","20","k.baker@randatmail.com","1","8"
"Emma Bailey","29","e.bailey@randatmail.com","2","5"
"Nicholas Taylor","28","n.taylor@randatmail.com","3","3"
1 Name Age Email fraction level calculus level
2 Spike Tucker 22 s.tucker@randatmail.com 7 3
3 Martin Payne 21 m.payne@randatmail.com 7 3
4 Kimberly Baker 20 k.baker@randatmail.com 1 8
5 Emma Bailey 29 e.bailey@randatmail.com 2 5
6 Nicholas Taylor 28 n.taylor@randatmail.com 3 3