| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -328,8 +328,10 @@ def test_students(self): | |||
| 328 | 328 | assert student.full_name == "Alexander Mueller" | |
| 329 | 329 | assert student.gender == "male" | |
| 330 | 330 | ||
| 331 | - | ||
| 332 | - | ||
| 333 | - | ||
| 334 | 331 | def test_examtype(self): | |
| 332 | + """@TODO""" | ||
| 333 | + pass | ||
| 334 | + | ||
| 335 | + def test_exam(self): | ||
| 336 | + """@TODO""" | ||
| 335 | 337 | pass | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -693,6 +693,7 @@ def end(self): | |||
| 693 | 693 | ||
| 694 | 694 | class TimegridDayObject(Result): | |
| 695 | 695 | """Information about one day in the time grid""" | |
| 696 | + | ||
| 696 | 697 | @lazyproperty | |
| 697 | 698 | def day(self): | |
| 698 | 699 | return self._data[u'day'] | |
@@ -727,10 +728,12 @@ def full_name(self): | |||
| 727 | 728 | def gender(self): | |
| 728 | 729 | return self._data[u'gender'] | |
| 729 | 730 | ||
| 731 | + | ||
| 730 | 732 | class StudentsList(ListResult): | |
| 731 | 733 | """A list of students""" | |
| 732 | 734 | _itemclass = StudentObject | |
| 733 | 735 | ||
| 736 | + | ||
| 734 | 737 | ''' | |
| 735 | 738 | @TODO: need additional rights | |
| 736 | 739 | class ExamTypeObject(Result): | |
@@ -739,4 +742,11 @@ class ExamTypeObject(Result): | |||
| 739 | 742 | class ExamTypeList(ListResult): | |
| 740 | 743 | """A list of exam types""" | |
| 741 | 744 | _itemclass = ExamTypeObject | |
| 745 | + | ||
| 746 | + class ExamObject(Result): | ||
| 747 | + """Represents an Exam.""" | ||
| 748 | + | ||
| 749 | + class ExamList(ListResult): | ||
| 750 | + """A list of exams.""" | ||
| 751 | + _itemclass = ExamObject | ||
| 742 | 752 | ''' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -312,6 +312,7 @@ class StudentObject(PersonObject): | |||
| 312 | 312 | def gender(self) -> str: | |
| 313 | 313 | ... | |
| 314 | 314 | ||
| 315 | + | ||
| 315 | 316 | class StudentsList(ListResult): | |
| 316 | 317 | _itemclass = StudentObject | |
| 317 | 318 | ||
@@ -413,6 +414,7 @@ class TimegridObject(ListResult): | |||
| 413 | 414 | def __getitem__(self, i: int) -> TimegridDayObject: | |
| 414 | 415 | ... | |
| 415 | 416 | ||
| 417 | + | ||
| 416 | 418 | """ | |
| 417 | 419 | @TODO: need additional rights | |
| 418 | 420 | ||
@@ -427,4 +429,16 @@ class ExamTypeList(ListResult): | |||
| 427 | 429 | ||
| 428 | 430 | def __getitem__(self, i: int) -> ExamTypeObject: | |
| 429 | 431 | ... | |
| 432 | + | ||
| 433 | + class ExamObject(Result): | ||
| 434 | + ... | ||
| 435 | + | ||
| 436 | + class ExamList(ListResult): | ||
| 437 | + _itemclass = ExamObject | ||
| 438 | + | ||
| 439 | + def filter(self, **criterions) -> ExamObject: | ||
| 440 | + ... | ||
| 441 | + | ||
| 442 | + def __getitem__(self, i: int) -> ExamObject: | ||
| 443 | + ... | ||
| 430 | 444 | """ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -335,13 +335,44 @@ def students(self): | |||
| 335 | 335 | @TODO: need additional rights | |
| 336 | 336 | @result_wrapper | |
| 337 | 337 | def examTypes(self): | |
| 338 | - """Information about the Exams. | ||
| 338 | + """Information about the Exam types. | ||
| 339 | 339 | ||
| 340 | 340 | :rtype: :py:class:`webuntis.objects.ExamTypeList` | |
| 341 | 341 | """ | |
| 342 | 342 | return objects.ExamTypeList, 'getExamTypes', {} | |
| 343 | + | ||
| 344 | + | ||
| 345 | + @result_wrapper | ||
| 346 | + def exams(self, start, end, examTypeId=0): | ||
| 347 | + """Information about the Exams. | ||
| 348 | + | ||
| 349 | + :type start: :py:class:`datetime.datetime` or :py:class:`datetime.date` or int | ||
| 350 | + :param start: The beginning of the time period. | ||
| 351 | + | ||
| 352 | + :type end: :py:class:`datetime.datetime` or :py:class:`datetime.date` or int | ||
| 353 | + :param end: The end of the time period. | ||
| 354 | + | ||
| 355 | + :param examTypeId: int, ?? | ||
| 356 | + | ||
| 357 | + :rtype: :py:class:`webuntis.objects.ExamList` | ||
| 358 | + """ | ||
| 359 | + | ||
| 360 | + json_start = utils.datetime_utils.format_date(start) | ||
| 361 | + json_end = utils.datetime_utils.format_date(end) | ||
| 362 | + | ||
| 363 | + if json_start > json_end: | ||
| 364 | + raise ValueError('Start can\'t be later than the end.') | ||
| 365 | + | ||
| 366 | + parameters = { | ||
| 367 | + 'startDate': json_start, | ||
| 368 | + 'endDate': json_end, | ||
| 369 | + 'examTypeId': examTypeId | ||
| 370 | + } | ||
| 371 | + | ||
| 372 | + return objects.ExamList, 'getExams', parameters | ||
| 343 | 373 | ''' | |
| 344 | 374 | ||
| 375 | + | ||
| 345 | 376 | class Session(JSONRPCSession, ResultWrapperMixin): | |
| 346 | 377 | """The origin of everything you want to do with the WebUntis API. Can be | |
| 347 | 378 | used as a context-manager to provide automatic log-out. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments