Bulk import of results

master
Markus Bauer 2023-06-23 12:09:13 +02:00
parent 00227caeed
commit 9d41ca1865
1 changed files with 11 additions and 0 deletions

View File

@ -349,6 +349,17 @@ class CakeCMS:
raise Exception('Need either student_id or user_id')
return self.get('testingresults/retrieve/' + str(testing_id), course=course, named_params=params).json()
def testingresults_import(self, testing_id, matriculation_to_points_dict, course=None):
"""
Mass import of points for one testing
:param testing_id:
:param matriculation_to_points_dict: for example {1234567: 0.0, 2512345: 9.5}. DO NOT USE None.
:param course:
:return:
"""
body = {'Import': {'data': 'mtknr,points\n' + '\n'.join(str(k)+','+str(v) for k, v in matriculation_to_points_dict.items())}}
return self.post('testingresults/import/' + str(testing_id), body, course=course).json()
def materials_index(self, course=None):
"""
Get a list of all accessible material categories and files.