| | |
| | | from aoi_gen.BerkiParse import BerkiParse |
| | | from aoi_gen.Problem import ProblemSource, Problem |
| | | from aoi_gen.Exam import Exam |
| | | import pkg_resources |
| | | import os |
| | | |
| | | if pkg_resources.resource_dir is not None: |
| | | template_path = os.path.join(pkg_resources.resource_dir, "/textemplates") |
| | | else: |
| | | template_path = "aoi_gen/textemplates" |
| | | |
| | | if __name__ == "__main__": |
| | | # from glob import glob |
| | | # |
| | | # # THIS IS TO BE READ FROM THE DATABASE |
| | | # filelist = glob("testcases/*") |
| | | # naloge = [] |
| | | # for i, f in enumerate(filelist): |
| | | # with open(f) as fd: |
| | | # cont = fd.read() |
| | | # naloge.append((i, cont)) |
| | | # source=[] |
| | | # for nal in naloge: |
| | | # par=BerkiParse(nal[1]) |
| | | # par.parseSections() |
| | | # source.append(ProblemSource(parser=par)) |
| | | |
| | | settings = { |
| | | 'exam_title': "Naslov izpita", |
| | | 'date': "27.10.2018", |
| | | 'faculty_name': "Fakulteta test", |
| | | 'faculty_id': 0, |
| | | 'exam_id': 0, |
| | | 'last_line': "Empty line", |
| | | 'start_number': 100, |
| | | 'sid_prefill': "11x0xxxx", } |
| | | "exam_title": "Naslov izpita", |
| | | "date": "27.10.2018", |
| | | "faculty_name": "Fakulteta test", |
| | | "faculty_id": 0, |
| | | "exam_id": 0, |
| | | "last_line": "Empty line", |
| | | "start_number": 100, |
| | | "sid_prefill": "11x0xxxx", |
| | | } |
| | | |
| | | student_list=[ |
| | | ("64990162", "Samo Penic"), |
| | | ] |
| | | student_list = [("64990162", "Samo Penic")] |
| | | |
| | | exam=Exam(settings=settings, student_list=student_list, number_of_papers=5) |
| | | exam = Exam(settings=settings, student_list=student_list, number_of_papers=5, template=template_path) |
| | | exam.loadProblemsFromDirectory("testcases/*.txt") |
| | | exam.generatePapers() |
| | | text=exam.exam_to_template() |
| | | #print(text) |
| | | exam_matrix=exam.get_answers() |
| | | print(exam_matrix) |
| | | with open('preverjanje.tex','w') as problem_fd: |
| | | with open("preverjanje.tex", "w") as problem_fd: |
| | | problem_fd.write(text) |