diff --git a/README.md b/README.md index c865f074642a336bc08961debf89b549e4cfea7f..798c5773628da5cb095558153b01af32e85b39ac 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ ## Usage -Invoke the script with `python3 gen.py -h` in order to see usage. Very limited -until now. +Invoke the script with `python3 grim.py -h` in order to see usage. Currently +many features are not yet implemented. Single and Multiple Chice questions +can be generated also in parametrized form. Example scripts can be found in `scripts/`. @@ -11,11 +12,13 @@ A first version of the tool that relied on autoilias is still in the repository (see `generator.py`). It will be removed as soon as the necessary features are implemented. +### Dependencies + +`pip install mistune` + ## TODO * Add a good description / documentation. -* Add instruction to produce multiple (parametrized) instances of a single -question. * Add more functionality (gap, alignment, etc.) * Make parsers more robust. * reverse ILIAS authentication mechanism for automated upload. diff --git a/hallgrim/IliasXMLCreator/gap.py b/hallgrim/IliasXMLCreator/gap.py index 6e794cb14ae9bd8ea2c93d568c61ea1297f71fe2..fbe51a909df77fbf86f0265ffacc683c9f76bff0 100644 --- a/hallgrim/IliasXMLCreator/gap.py +++ b/hallgrim/IliasXMLCreator/gap.py @@ -78,7 +78,8 @@ class GapQuestion: outcomes = et.Element('outcomes') outcomes.append(simple_elemet('decvar')) root.append(outcomes) - for i, (_, correct, points) in enumerate(self.questions): + is_gap = lambda t: type(t) = tuple + for i, (_, correct, points) in enumerate(filter(is_gap, self.gap_list)): root.append(respcondition(points if correct else 0, i, True)) root.append(respcondition(points if not correct else 0, i, False)) return root diff --git a/hallgrim/IliasXMLCreator/xmlBuildingBlocks.py b/hallgrim/IliasXMLCreator/xmlBuildingBlocks.py index 3fa2aa02e067710b117873a78af71110bcd1a18e..428f184166b2686b4ab85af5131292bd850f9325 100644 --- a/hallgrim/IliasXMLCreator/xmlBuildingBlocks.py +++ b/hallgrim/IliasXMLCreator/xmlBuildingBlocks.py @@ -99,7 +99,7 @@ def response_str(ident, columns): response_str.append(render_fib) return response_str -def response_choice(ident, answers) +def response_choice(ident, answers): response_str = et.Element('response_str', attrib={'ident': indent, 'rcardinality': 'Single'}) render_choice = et.Element('render_choice', attrib={'shuffle': 'Yes'}) for i, answer in enumerate(answers): diff --git a/hallgrim/ilias_templates/gap/1478024104__9310__qti_82996.xml b/hallgrim/ilias_templates/gap/1478024104__9310__qti_82996.xml index 447d6b3e1362237f69344b66f32e74d30d984029..3d1db36ec4c2466da4521235126f50cd5751b9d9 100644 --- a/hallgrim/ilias_templates/gap/1478024104__9310__qti_82996.xml +++ b/hallgrim/ilias_templates/gap/1478024104__9310__qti_82996.xml @@ -10,7 +10,7 @@ <qtimetadata> <qtimetadatafield> <fieldlabel>ILIAS_VERSION</fieldlabel> - <fieldentry>5.1.8 2016-08-03</fieldentry> + <fieldentry>5.1.8 2016-08-03</fieldentry> </qtimetadatafield> <qtimetadatafield> <fieldlabel>QUESTIONTYPE</fieldlabel> diff --git a/scripts/info1_02_klausur.py b/scripts/info1_02_klausur.py new file mode 100644 index 0000000000000000000000000000000000000000..3ebc25c119a6a4ea2cb440ebb1f34397a9c525d8 --- /dev/null +++ b/scripts/info1_02_klausur.py @@ -0,0 +1,30 @@ +meta = { + 'author': 'Carsten Damm', + 'title': 'Vermischtes zu elementaren Daten (I1-ID: e638zfi0qtg0)', + 'type': 'multiple choice', + 'points': 0.5, # per correct choice +} + +task = """ Markieren Sie alle zutreffenden Aussagen: """ + +choices = """ +[ ] `int x = Integer.MAX_VALUE; x++;` verursacht eine OverflowException. +[ ] Steuerzeichen werden vom Steuerwerk interpretiert. +[X] `if (b > 0 && a/b < 2)` ... ist besser als `if (a/b < 2 && b > 0)` ... +[ ] Umlaute im Quelltext verursachen Compilezeitfehler. +[X] `"h\u00F6chstens 6 Zeichen"` ist ein Literal. +[ ] `Integer.MAX_VALUE++;` verursacht einen Ganzzahlüberlauf. +[ ] UTF-8 ordnet jedem Zeichen eine Folge von 8 Bytes zu. +[X] Ganzzahl-Arithmetik ist schneller als Gleitkomma-Arithmetik. +""" + +feedback = """ +Die folgenden Aussagen sind korrekt: + +* `if (b > 0 && a/b < 2)` ... ist besser als `if (a/b < 2 && b > 0)` ... + * *Begründung:* `a/b < 2` ist aufwändiger zu berechnen als `b > 0`. Bei einer Prüfung des Wahrheitswerts einer Konjunktion muss der zweite Term nicht betrachtet werden, wenn der erste falsch ist. +* `"h\u00F6chstens 6 Zeichen"` ist ein Literal. + * *Begründung:* Da der String eine konstanten Wert darstellt ist er als Literal zu bezeichnen. +* Ganzzahl-Arithmetik ist schneller als Gleitkomma-Arithmetik. + * *Begründung:* Floating Point Arithmetik ist wesentlich aufwändiger als Integer Arithmetik (siehe zum Vergleich: Zweitkomplement und IEE-754) +""" \ No newline at end of file