ladok3 4.12__tar.gz → 4.13__tar.gz

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.
Files changed (33) hide show
  1. {ladok3-4.12 → ladok3-4.13}/PKG-INFO +1 -1
  2. {ladok3-4.12 → ladok3-4.13}/pyproject.toml +1 -1
  3. {ladok3-4.12 → ladok3-4.13}/src/ladok3/api.nw +3 -0
  4. {ladok3-4.12 → ladok3-4.13}/src/ladok3/ladok3.nw +46 -7
  5. {ladok3-4.12 → ladok3-4.13}/LICENSE +0 -0
  6. {ladok3-4.12 → ladok3-4.13}/README.md +0 -0
  7. {ladok3-4.12 → ladok3-4.13}/doc/Makefile +0 -0
  8. {ladok3-4.12 → ladok3-4.13}/doc/abstract.tex +0 -0
  9. {ladok3-4.12 → ladok3-4.13}/doc/ladok3.tex +0 -0
  10. {ladok3-4.12 → ladok3-4.13}/doc/preamble.tex +0 -0
  11. {ladok3-4.12 → ladok3-4.13}/makefiles/doc.mk +0 -0
  12. {ladok3-4.12 → ladok3-4.13}/makefiles/exam.mk +0 -0
  13. {ladok3-4.12 → ladok3-4.13}/makefiles/haskell.mk +0 -0
  14. {ladok3-4.12 → ladok3-4.13}/makefiles/miun.course.mk +0 -0
  15. {ladok3-4.12 → ladok3-4.13}/makefiles/miun.depend.mk +0 -0
  16. {ladok3-4.12 → ladok3-4.13}/makefiles/miun.docs.mk +0 -0
  17. {ladok3-4.12 → ladok3-4.13}/makefiles/miun.port.mk +0 -0
  18. {ladok3-4.12 → ladok3-4.13}/makefiles/miun.pub.mk +0 -0
  19. {ladok3-4.12 → ladok3-4.13}/makefiles/noweb.mk +0 -0
  20. {ladok3-4.12 → ladok3-4.13}/makefiles/pkg.mk +0 -0
  21. {ladok3-4.12 → ladok3-4.13}/makefiles/portability.mk +0 -0
  22. {ladok3-4.12 → ladok3-4.13}/makefiles/pub.mk +0 -0
  23. {ladok3-4.12 → ladok3-4.13}/makefiles/results.mk +0 -0
  24. {ladok3-4.12 → ladok3-4.13}/makefiles/subdir.mk +0 -0
  25. {ladok3-4.12 → ladok3-4.13}/makefiles/tex.mk +0 -0
  26. {ladok3-4.12 → ladok3-4.13}/makefiles/transform.mk +0 -0
  27. {ladok3-4.12 → ladok3-4.13}/src/ladok3/.gitignore +0 -0
  28. {ladok3-4.12 → ladok3-4.13}/src/ladok3/Makefile +0 -0
  29. {ladok3-4.12 → ladok3-4.13}/src/ladok3/cli.nw +0 -0
  30. {ladok3-4.12 → ladok3-4.13}/src/ladok3/data.nw +0 -0
  31. {ladok3-4.12 → ladok3-4.13}/src/ladok3/report.nw +0 -0
  32. {ladok3-4.12 → ladok3-4.13}/src/ladok3/student.nw +0 -0
  33. {ladok3-4.12 → ladok3-4.13}/src/ladok3/undoc.nw +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ladok3
3
- Version: 4.12
3
+ Version: 4.13
4
4
  Summary: Python wrapper and CLI for the LADOK3 REST API.
5
5
  Home-page: https://github.com/dbosk/ladok3
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ladok3"
3
- version = "4.12"
3
+ version = "4.13"
4
4
  description = "Python wrapper and CLI for the LADOK3 REST API."
5
5
  authors = [
6
6
  "Daniel Bosk <dbosk@kth.se>",
@@ -889,6 +889,9 @@ Note that since this is a new result, we must provide the [[StudieresultatUID]]
889
889
  where we want to add the result.
890
890
  When we've done this, we'll get a [[ResultatUID]] back in the response.
891
891
  From then on, it's the [[ResultatUID]] that's interesting.
892
+
893
+ Note also that we can use [[course_instance_id]] as [[component_id]], this will
894
+ set the result on the whole course.
892
895
  <<LadokSession data methods>>=
893
896
  def create_result_JSON(self,
894
897
  student_id, course_instance_id, component_id,
@@ -1122,12 +1122,8 @@ By trial-and-error, it seems like the faux courses has none of the attributes
1122
1122
  that the real courses have.
1123
1123
  However, we try our best.
1124
1124
  <<assign common CourseInstance data to private attributes>>=
1125
- if "IngaendeMoment" in data:
1126
- self.__components = [CourseComponent(
1127
- ladok=self.ladok, course=self,
1128
- **component) for component in data["IngaendeMoment"]]
1129
- else:
1130
- self.__components = []
1125
+ self.__components = []
1126
+ <<add course components to [[self.__components]]>>
1131
1127
  <<assign CourseInstance data to private attributes>>=
1132
1128
  <<assign common CourseInstance data to private attributes>>
1133
1129
 
@@ -1203,6 +1199,33 @@ def components(self, /, **kwargs):
1203
1199
  @
1204
1200
 
1205
1201
 
1202
+ \subsection{Course components}
1203
+
1204
+ We need to add the courses components to the course instance.
1205
+ That is things like LAB1 or EXA1 that make up the course in LADOK.
1206
+ <<add course components to [[self.__components]]>>=
1207
+ if "IngaendeMoment" in data:
1208
+ self.__components += [CourseComponent(
1209
+ ladok=self.ladok, course=self,
1210
+ **component) for component in data["IngaendeMoment"]]
1211
+ @
1212
+
1213
+ We also add the course itself as a component.
1214
+ This is to handle the grade on the course itself.
1215
+ Once all the components have a grade, the course itself will get a grade.
1216
+ This component represents that grade.
1217
+ It will get the course code as its code.
1218
+ <<add course components to [[self.__components]]>>=
1219
+ try:
1220
+ course_component_data = data.copy()
1221
+ course_component_data["ladok"] = self.ladok
1222
+ self.__components.append(CourseComponent(course=self,
1223
+ **course_component_data))
1224
+ except KeyError:
1225
+ pass
1226
+ @
1227
+
1228
+
1206
1229
  \section{Course components}
1207
1230
 
1208
1231
  The [[CourseComponent]] class will make the attributes available.
@@ -1415,13 +1438,15 @@ We can pull these from LADOK as well.
1415
1438
  We construct [[CourseResult]] objects using a [[CourseRegistration]] object.
1416
1439
  From the response we get from LADOK, we construct [[CourseResult]] objects that
1417
1440
  deal with the details.
1441
+ (It's a bit unclear why [[Kursversioner]] is a list, so far it has always
1442
+ worked to take the first.)
1418
1443
  <<pull existing CourseResult objects from LADOK>>=
1419
1444
  response = self.ladok.student_results_JSON(
1420
1445
  self.__student.ladok_id, self.education_id
1421
1446
  )["Kursversioner"][0]
1422
1447
 
1423
- #self.__results_id = response["Uid"]
1424
1448
  self.__results = []
1449
+
1425
1450
  for result in response["VersionensModuler"]:
1426
1451
  try:
1427
1452
  self.__results.append(CourseResult(ladok=self.ladok,
@@ -1432,6 +1457,20 @@ for result in response["VersionensModuler"]:
1432
1457
  pass
1433
1458
  @
1434
1459
 
1460
+ As with the components, the course grade itself is a special case.
1461
+ That data is not in [[VersionensModuler]], but in [[VersionensKurs]].
1462
+ But we can do the same with it, just as we could with the components.
1463
+ (And this works since it's a component in [[self.components()]].)
1464
+ <<pull existing CourseResult objects from LADOK>>=
1465
+ try:
1466
+ self.__results.append(CourseResult(ladok=self.ladok,
1467
+ components=self.components(),
1468
+ student=self.__student,
1469
+ **response["VersionensKurs"]))
1470
+ except TypeError:
1471
+ pass
1472
+ @
1473
+
1435
1474
  Now we can see which components from [[self.components]] are missing from
1436
1475
  [[self.__results]] and just add empty results for those.
1437
1476
  <<add new CourseResult objects for missing components>>=
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes