ladok3 4.19__py3-none-any.whl → 5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ladok3 might be problematic. Click here for more details.
- doc/ltxobj/ladok3.pdf +0 -0
- ladok3/data.nw +26 -8
- ladok3/data.py +23 -3
- ladok3/report.nw +17 -2
- ladok3/report.py +11 -3
- {ladok3-4.19.dist-info → ladok3-5.0.dist-info}/METADATA +1 -1
- {ladok3-4.19.dist-info → ladok3-5.0.dist-info}/RECORD +10 -10
- {ladok3-4.19.dist-info → ladok3-5.0.dist-info}/LICENSE +0 -0
- {ladok3-4.19.dist-info → ladok3-5.0.dist-info}/WHEEL +0 -0
- {ladok3-4.19.dist-info → ladok3-5.0.dist-info}/entry_points.txt +0 -0
doc/ltxobj/ladok3.pdf
CHANGED
|
Binary file
|
ladok3/data.nw
CHANGED
|
@@ -16,7 +16,7 @@ from LADOK (\cref{DataCommand}).
|
|
|
16
16
|
This is a subcommand for the [[ladok]] command-line interface.
|
|
17
17
|
It can be used like this:
|
|
18
18
|
\begin{minted}{bash}
|
|
19
|
-
ladok
|
|
19
|
+
ladok course DD1315 > DD1315.csv
|
|
20
20
|
\end{minted}
|
|
21
21
|
This program will produce CSV-formated data to answer the questions above.
|
|
22
22
|
The data is formated like this:
|
|
@@ -26,11 +26,11 @@ The data is formated like this:
|
|
|
26
26
|
\item component,
|
|
27
27
|
\item student (pseudonym),
|
|
28
28
|
\item grade,
|
|
29
|
-
\item normalized
|
|
29
|
+
\item either absolute date or normalized to the course start and finish.
|
|
30
30
|
\end{itemize}
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
\section{The [[
|
|
33
|
+
\section{The [[course]] subcommand}\label{DataCommand}
|
|
34
34
|
|
|
35
35
|
This is a subcommand run as part of the [[ladok3.cli]] module.
|
|
36
36
|
We provide a function [[add_command_options]] that adds the subcommand options
|
|
@@ -59,7 +59,7 @@ def command(ladok, args):
|
|
|
59
59
|
We add a subparser.
|
|
60
60
|
We set it up to use the function [[command]].
|
|
61
61
|
<<add data parser to parser>>=
|
|
62
|
-
data_parser = parser.add_parser("
|
|
62
|
+
data_parser = parser.add_parser("course",
|
|
63
63
|
help="Returns course results data in CSV form",
|
|
64
64
|
description="""
|
|
65
65
|
Returns the results in CSV form for all first-time registered students.
|
|
@@ -79,9 +79,10 @@ course_rounds = filter_rounds(
|
|
|
79
79
|
ladok.search_course_rounds(code=args.course_code),
|
|
80
80
|
args.rounds)
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
if args.header:
|
|
83
|
+
data_writer.writerow([
|
|
84
|
+
"Course", "Round", "Component", "Student", "Grade", "Time"
|
|
85
|
+
])
|
|
85
86
|
for course_round in course_rounds:
|
|
86
87
|
data = extract_data_for_round(ladok, course_round, args)
|
|
87
88
|
|
|
@@ -91,6 +92,7 @@ for course_round in course_rounds:
|
|
|
91
92
|
student, grade, time]
|
|
92
93
|
)
|
|
93
94
|
@ We must take a course code and a delimiter as arguments.
|
|
95
|
+
We also want to know if we want a header or not.
|
|
94
96
|
<<add data command arguments to data parser>>=
|
|
95
97
|
data_parser.add_argument("course_code",
|
|
96
98
|
help="The course code of the course for which to export data")
|
|
@@ -100,6 +102,9 @@ data_parser.add_argument("-d", "--delimiter",
|
|
|
100
102
|
help="The delimiter for the CSV output; "
|
|
101
103
|
"default is a tab character to be compatible with POSIX commands, "
|
|
102
104
|
"use `-d,` or `-d ,` to get comma-separated values.")
|
|
105
|
+
|
|
106
|
+
data_parser.add_argument("-H", "--header", action="store_true",
|
|
107
|
+
help="Print a header line with the column names.")
|
|
103
108
|
@
|
|
104
109
|
|
|
105
110
|
We filter the rounds.
|
|
@@ -154,7 +159,20 @@ def extract_data_for_round(ladok, course_round, args):
|
|
|
154
159
|
else:
|
|
155
160
|
<<extract grade and normalized date from result data>>
|
|
156
161
|
|
|
157
|
-
yield student, component, grade
|
|
162
|
+
<<yield [[student, component, grade]] and date>>
|
|
163
|
+
@
|
|
164
|
+
|
|
165
|
+
We want to yield the data in CSV form, so we simply yield a tuple.
|
|
166
|
+
The date is either the normalized date or the date from the result data.
|
|
167
|
+
<<yield [[student, component, grade]] and date>>=
|
|
168
|
+
if args.normalize_date:
|
|
169
|
+
yield student, component, grade, normalized_date
|
|
170
|
+
elif result_data:
|
|
171
|
+
yield student, component, grade, result_data["Examinationsdatum"]
|
|
172
|
+
<<add data command arguments to data parser>>=
|
|
173
|
+
data_parser.add_argument("-n", "--normalize-date", action="store_true",
|
|
174
|
+
help="Normalize the date to the start of the course, "
|
|
175
|
+
"otherwise the date is printed as is.")
|
|
158
176
|
@
|
|
159
177
|
|
|
160
178
|
\subsection{Get round data}
|
ladok3/data.py
CHANGED
|
@@ -60,7 +60,10 @@ def extract_data_for_round(ladok, course_round, args):
|
|
|
60
60
|
grade = "-"
|
|
61
61
|
normalized_date = None
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
if args.normalize_date:
|
|
64
|
+
yield student, component, grade, normalized_date
|
|
65
|
+
elif result_data:
|
|
66
|
+
yield student, component, grade, result_data["Examinationsdatum"]
|
|
64
67
|
|
|
65
68
|
|
|
66
69
|
def filter_student_results(student, results):
|
|
@@ -132,7 +135,7 @@ def has_credit_transfer(results):
|
|
|
132
135
|
|
|
133
136
|
def add_command_options(parser):
|
|
134
137
|
data_parser = parser.add_parser(
|
|
135
|
-
"
|
|
138
|
+
"course",
|
|
136
139
|
help="Returns course results data in CSV form",
|
|
137
140
|
description="""
|
|
138
141
|
Returns the results in CSV form for all first-time registered students.
|
|
@@ -151,6 +154,13 @@ def add_command_options(parser):
|
|
|
151
154
|
"default is a tab character to be compatible with POSIX commands, "
|
|
152
155
|
"use `-d,` or `-d ,` to get comma-separated values.",
|
|
153
156
|
)
|
|
157
|
+
|
|
158
|
+
data_parser.add_argument(
|
|
159
|
+
"-H",
|
|
160
|
+
"--header",
|
|
161
|
+
action="store_true",
|
|
162
|
+
help="Print a header line with the column names.",
|
|
163
|
+
)
|
|
154
164
|
data_parser.add_argument(
|
|
155
165
|
"-r",
|
|
156
166
|
"--rounds",
|
|
@@ -158,6 +168,13 @@ def add_command_options(parser):
|
|
|
158
168
|
help="The round codes for the rounds to include, "
|
|
159
169
|
"otherwise all rounds will be included.",
|
|
160
170
|
)
|
|
171
|
+
data_parser.add_argument(
|
|
172
|
+
"-n",
|
|
173
|
+
"--normalize-date",
|
|
174
|
+
action="store_true",
|
|
175
|
+
help="Normalize the date to the start of the course, "
|
|
176
|
+
"otherwise the date is printed as is.",
|
|
177
|
+
)
|
|
161
178
|
data_parser.add_argument(
|
|
162
179
|
"-t",
|
|
163
180
|
"--time-limit",
|
|
@@ -188,7 +205,10 @@ def command(ladok, args):
|
|
|
188
205
|
ladok.search_course_rounds(code=args.course_code), args.rounds
|
|
189
206
|
)
|
|
190
207
|
|
|
191
|
-
|
|
208
|
+
if args.header:
|
|
209
|
+
data_writer.writerow(
|
|
210
|
+
["Course", "Round", "Component", "Student", "Grade", "Time"]
|
|
211
|
+
)
|
|
192
212
|
for course_round in course_rounds:
|
|
193
213
|
data = extract_data_for_round(ladok, course_round, args)
|
|
194
214
|
|
ladok3/report.nw
CHANGED
|
@@ -115,11 +115,24 @@ try:
|
|
|
115
115
|
set_grade(ladok, args,
|
|
116
116
|
student_id, course_code, component_code, grade, date, graders)
|
|
117
117
|
except Exception as err:
|
|
118
|
-
|
|
118
|
+
<<try to resolve [[student]] from [[ladok]] using [[student_id]]>>
|
|
119
|
+
print(f"{course_code} {component_code}={grade} ({date}) {student}: "
|
|
119
120
|
f"{err}",
|
|
120
121
|
file=sys.stderr)
|
|
121
122
|
@
|
|
122
123
|
|
|
124
|
+
The reason we want to resolve the student from LADOK is that the [[student_id]]
|
|
125
|
+
might be a personnummer or a LADOK ID---if the latter, it's not particularly
|
|
126
|
+
readable for a human and we can't use the LADOK ID in the LADOK web interface
|
|
127
|
+
when we want to deal with the errors manually.
|
|
128
|
+
But if we resolve the student, then we get a readable name.
|
|
129
|
+
<<try to resolve [[student]] from [[ladok]] using [[student_id]]>>=
|
|
130
|
+
try:
|
|
131
|
+
student = ladok.get_student(student_id)
|
|
132
|
+
except Exception:
|
|
133
|
+
student = student_id
|
|
134
|
+
@
|
|
135
|
+
|
|
123
136
|
When we set the grade, there are a few cases that should be handled.
|
|
124
137
|
If the grade isn't attested, we try to change it.
|
|
125
138
|
(This might still fail if the grade is finalized but not attested.)
|
|
@@ -254,8 +267,10 @@ try:
|
|
|
254
267
|
args.student_id, args.course_code, args.component_code,
|
|
255
268
|
args.grade, args.date, args.graders)
|
|
256
269
|
except Exception as err:
|
|
270
|
+
student_id = args.student_id
|
|
271
|
+
<<try to resolve [[student]] from [[ladok]] using [[student_id]]>>
|
|
257
272
|
print(f"{args.course_code} {args.component_code}={args.grade} ({args.date}) "
|
|
258
|
-
f"{
|
|
273
|
+
f"{student}: {err}",
|
|
259
274
|
file=sys.stderr)
|
|
260
275
|
@
|
|
261
276
|
|
ladok3/report.py
CHANGED
|
@@ -27,9 +27,14 @@ def report_one_result(ladok, args):
|
|
|
27
27
|
args.graders,
|
|
28
28
|
)
|
|
29
29
|
except Exception as err:
|
|
30
|
+
student_id = args.student_id
|
|
31
|
+
try:
|
|
32
|
+
student = ladok.get_student(student_id)
|
|
33
|
+
except Exception:
|
|
34
|
+
student = student_id
|
|
30
35
|
print(
|
|
31
36
|
f"{args.course_code} {args.component_code}={args.grade} ({args.date}) "
|
|
32
|
-
f"{
|
|
37
|
+
f"{student}: {err}",
|
|
33
38
|
file=sys.stderr,
|
|
34
39
|
)
|
|
35
40
|
|
|
@@ -49,9 +54,12 @@ def report_many_results(ladok, args):
|
|
|
49
54
|
graders,
|
|
50
55
|
)
|
|
51
56
|
except Exception as err:
|
|
57
|
+
try:
|
|
58
|
+
student = ladok.get_student(student_id)
|
|
59
|
+
except Exception:
|
|
60
|
+
student = student_id
|
|
52
61
|
print(
|
|
53
|
-
f"{course_code} {component_code}={grade} ({date}) {
|
|
54
|
-
f"{err}",
|
|
62
|
+
f"{course_code} {component_code}={grade} ({date}) {student}: " f"{err}",
|
|
55
63
|
file=sys.stderr,
|
|
56
64
|
)
|
|
57
65
|
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
doc/ltxobj/ladok3.pdf,sha256=
|
|
1
|
+
doc/ltxobj/ladok3.pdf,sha256=5veFT8zO_oUWLCBQVqmwLRWsy3_34dZms1RgitsNzrM,2284649
|
|
2
2
|
ladok3/.gitignore,sha256=QOcCshtjIsFasi4vaqFcooBWPJkxVWaoYEWOBBtdY_w,81
|
|
3
3
|
ladok3/Makefile,sha256=Jy6OFjoVLU9YivnVxctxI_zrUOK9ysEOiistJ3ST6Nw,557
|
|
4
4
|
ladok3/__init__.py,sha256=2ySW9vSJ0joOV5TH9dtK_CAOdk1PByZ7jYfAwQxfAhc,87708
|
|
5
5
|
ladok3/api.nw,sha256=o7ZWO6eplSG3ReS0Y-rzcrLP2yiFVwvQUtg6dPDXG5E,66716
|
|
6
6
|
ladok3/cli.nw,sha256=sA5kevvAWBkzZHZ3UBkPEHoWvPw5yYtGYiPEnWMmjus,22864
|
|
7
7
|
ladok3/cli.py,sha256=6R7B0XVvYFlHcMbv6E73KOeI3ZGQFeQN2-ojz12H1vU,12555
|
|
8
|
-
ladok3/data.nw,sha256=
|
|
9
|
-
ladok3/data.py,sha256=
|
|
8
|
+
ladok3/data.nw,sha256=NddmEnzfgaXZkYyaOLle67MNySy4YKWx4OXMWAOAMkA,12676
|
|
9
|
+
ladok3/data.py,sha256=nLta8ZlSmgRqXZoCbJqtw6KlHH-EyZfImbDcPs74G2U,7324
|
|
10
10
|
ladok3/ladok.bash,sha256=zGfTFdtos2zLjV13pzfK-1uCy2b_lF2qUKMoL2ExW7c,1441
|
|
11
11
|
ladok3/ladok3.nw,sha256=mftysbBD9CLaKD8JgRcSO9KOnjV6koOd2dfmbSSJJi0,55594
|
|
12
|
-
ladok3/report.nw,sha256=
|
|
13
|
-
ladok3/report.py,sha256=
|
|
12
|
+
ladok3/report.nw,sha256=nmyP6TnSYBsMIeG2bdiVQ7LqQN_gEqyEfbDrrOR1afc,10068
|
|
13
|
+
ladok3/report.py,sha256=BDFbTsO2mwFQoCysRnak2VYA3p4RYOnxaU6zamhqbAY,6091
|
|
14
14
|
ladok3/student.nw,sha256=qgJN1IA6oIoI4RsfWsoTaO2yxdtB_y3mBNSmlccoE4Y,4395
|
|
15
15
|
ladok3/student.py,sha256=a3z5dY18UXqxZh4WtEhgsUdHePhRNBiU5GaNNP6LKxI,2178
|
|
16
16
|
ladok3/undoc.nw,sha256=rRAZ8fC44PD2hBDF8TeEg1hyge_-vd-ScRcojRXQycI,19841
|
|
17
|
-
ladok3-
|
|
18
|
-
ladok3-
|
|
19
|
-
ladok3-
|
|
20
|
-
ladok3-
|
|
21
|
-
ladok3-
|
|
17
|
+
ladok3-5.0.dist-info/LICENSE,sha256=Oe-mWTBQ-MzuA4jGuRDPDxQtMe8SuP_YjSQl7SOtZ7Q,1155
|
|
18
|
+
ladok3-5.0.dist-info/METADATA,sha256=8R5uIVTEFZfciQhdgCKklOxTAn6x2U7wD3LAPLCjGYs,9370
|
|
19
|
+
ladok3-5.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
20
|
+
ladok3-5.0.dist-info/entry_points.txt,sha256=pi-KKP5Obo0AyuDjXQUpadS9kIvAY2_5ORhPgEYlJv8,41
|
|
21
|
+
ladok3-5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|