Skip to content
Snippets Groups Projects
Commit eeb0f7db authored by Jan Maximilian Michal's avatar Jan Maximilian Michal
Browse files

Decoded and pretty-printed code

parent 6aa1fd49
No related branches found
No related tags found
No related merge requests found
import argparse import argparse
import base64
import json import json
import re import re
import sys import sys
...@@ -15,7 +16,8 @@ tasks_path = ('./assessment/section') ...@@ -15,7 +16,8 @@ tasks_path = ('./assessment/section')
users = './tst_active/row' users = './tst_active/row'
solutions = './tst_solutions/row[@question_fi="%s"]' solutions = './tst_solutions/row[@question_fi="%s"]'
lecturer_xpath = './MetaData/Lifecycle/Contribute[@Role="Author"]/Entity/text()' lecturer_xpath = './MetaData/Lifecycle/Contribute[@Role="Author"]/Entity/text()'
def eat_qti(tree, only_of_type=('assSourceCode',), **kwargs): def eat_qti(tree, only_of_type=('assSourceCode',), **kwargs):
tasks = tree.xpath(tasks_path)[0] tasks = tree.xpath(tasks_path)[0]
...@@ -39,8 +41,12 @@ def eat_users(results_tree): ...@@ -39,8 +41,12 @@ def eat_users(results_tree):
for row in results_tree.xpath(users)} for row in results_tree.xpath(users)}
def convert_code(text):
return base64.b64decode(text).decode('utf-8').split('\n')
def eat_solutions(results_tree, task_id): def eat_solutions(results_tree, task_id):
return {row.attrib['active_fi']: row.attrib['value1'] return {row.attrib['active_fi']: convert_code(row.attrib['value1'])
for row in results_tree.xpath(solutions % task_id)} for row in results_tree.xpath(solutions % task_id)}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment