Skip to content

Commit

Permalink
Bug fix: new multilanguage question type was specified to be a user-d…
Browse files Browse the repository at this point in the history
…efined

question type rather than builtin, so documentation was not being displayed.
  • Loading branch information
trampgeek committed Nov 9, 2023
1 parent 3172598 commit 31658d8
Showing 1 changed file with 83 additions and 83 deletions.
166 changes: 83 additions & 83 deletions db/builtin_PROTOTYPES.xml
Original file line number Diff line number Diff line change
Expand Up @@ -326,44 +326,44 @@ int main() {
<globalextra></globalextra>
<useace>1</useace>
<resultcolumns></resultcolumns>
<template><![CDATA[import json
student_answer = """{{ STUDENT_ANSWER | e('py') }}"""
SEPARATOR = "#<ab@17943918#@>#"
error_count = 0
def error(s):
global error_count
print(s)
error_count += 1
try:
graph_rep = json.loads(student_answer)
node_id_to_name_map = {}
for i, node in enumerate(graph_rep['nodes']):
name_stripped = node[0].strip()
node_id_to_name_map[i] = name_stripped if name_stripped != '' else ('#' + str(i))
#print("Nodes:", nodes)
edges = graph_rep['edges']
#print("Edges:", edges)
graph = {}
for node_id, node_name in sorted(node_id_to_name_map.items()):
edges = []
for id0, id1, edge_label, *loc in graph_rep['edges']:
if id0 == node_id:
edges.append((node_id_to_name_map[id1], edge_label.strip()))
edges.sort()
graph[node_name] = edges
except json.JSONDecodeError as e:
raise Exception("Oops. Illegal graph received (exception {}). Please report (unless you did something silly yourself)".format(e))
{% for TEST in TESTCASES %}
{{ TEST.testcode }}
{{ TEST.extra }}
{% if not loop.last %}
print(SEPARATOR)
{% endif %}
<template><![CDATA[import json
student_answer = """{{ STUDENT_ANSWER | e('py') }}"""
SEPARATOR = "#<ab@17943918#@>#"
error_count = 0
def error(s):
global error_count
print(s)
error_count += 1
try:
graph_rep = json.loads(student_answer)
node_id_to_name_map = {}
for i, node in enumerate(graph_rep['nodes']):
name_stripped = node[0].strip()
node_id_to_name_map[i] = name_stripped if name_stripped != '' else ('#' + str(i))
#print("Nodes:", nodes)
edges = graph_rep['edges']
#print("Edges:", edges)
graph = {}
for node_id, node_name in sorted(node_id_to_name_map.items()):
edges = []
for id0, id1, edge_label, *loc in graph_rep['edges']:
if id0 == node_id:
edges.append((node_id_to_name_map[id1], edge_label.strip()))
edges.sort()
graph[node_name] = edges
except json.JSONDecodeError as e:
raise Exception("Oops. Illegal graph received (exception {}). Please report (unless you did something silly yourself)".format(e))
{% for TEST in TESTCASES %}
{{ TEST.testcode }}
{{ TEST.extra }}
{% if not loop.last %}
print(SEPARATOR)
{% endif %}
{% endfor %}]]></template>
<iscombinatortemplate>1</iscombinatortemplate>
<allowmultiplestdins>0</allowmultiplestdins>
Expand Down Expand Up @@ -632,7 +632,7 @@ public class __tester__ {
<hidden>0</hidden>
<idnumber></idnumber>
<coderunnertype>multilanguage</coderunnertype>
<prototypetype>2</prototypetype>
<prototypetype>1</prototypetype>
<allornothing>1</allornothing>
<penaltyregime>10, 20, ...</penaltyregime>
<precheck>0</precheck>
Expand All @@ -657,15 +657,15 @@ language_extension_map = {
'c':'c'
, 'cpp':'cpp'
, 'java':'java'
, 'python3':'py'
, 'python3':'py'
, 'perl':'pl'
, 'php':'php'
, 'ruby':'rb'
, 'javascript':'js'
, 'c#':'cs'
, 'golang':'go'
}
if language not in language_extension_map.keys():
Expand Down Expand Up @@ -1337,47 +1337,47 @@ print(SEPARATOR)
<globalextra></globalextra>
<useace>1</useace>
<resultcolumns></resultcolumns>
<template><![CDATA[import json
student_answer = """{{ STUDENT_ANSWER | e('py') }}"""
SEPARATOR = "#<ab@17943918#@>#"
error_count = 0
def error(s):
global error_count
print(s)
error_count += 1
try:
graph_rep = json.loads(student_answer)
node_id_to_name_map = {}
for i, node in enumerate(graph_rep['nodes']):
name_stripped = node[0].strip()
node_id_to_name_map[i] = name_stripped if name_stripped != '' else ('#' + str(i))
#print("Nodes:", nodes)
edges = graph_rep['edges']
#print("Edges:", edges)
graph = {}
for node_id, node_name in sorted(node_id_to_name_map.items()):
edges = []
for id0, id1, edge_label, *loc in graph_rep['edges']:
label_stripped = edge_label.strip()
if id0 == node_id:
edges.append((node_id_to_name_map[id1], label_stripped))
elif id1 == node_id:
edges.append((node_id_to_name_map[id0], label_stripped))
edges.sort()
graph[node_name] = edges
except json.JSONDecodeError as e:
raise Exception("Oops. Illegal graph received (exception {}). Please report (unless you did something silly yourself)".format(e))
{% for TEST in TESTCASES %}
{{ TEST.testcode }}
{{ TEST.extra }}
{% if not loop.last %}
print(SEPARATOR)
{% endif %}
<template><![CDATA[import json
student_answer = """{{ STUDENT_ANSWER | e('py') }}"""
SEPARATOR = "#<ab@17943918#@>#"
error_count = 0
def error(s):
global error_count
print(s)
error_count += 1
try:
graph_rep = json.loads(student_answer)
node_id_to_name_map = {}
for i, node in enumerate(graph_rep['nodes']):
name_stripped = node[0].strip()
node_id_to_name_map[i] = name_stripped if name_stripped != '' else ('#' + str(i))
#print("Nodes:", nodes)
edges = graph_rep['edges']
#print("Edges:", edges)
graph = {}
for node_id, node_name in sorted(node_id_to_name_map.items()):
edges = []
for id0, id1, edge_label, *loc in graph_rep['edges']:
label_stripped = edge_label.strip()
if id0 == node_id:
edges.append((node_id_to_name_map[id1], label_stripped))
elif id1 == node_id:
edges.append((node_id_to_name_map[id0], label_stripped))
edges.sort()
graph[node_name] = edges
except json.JSONDecodeError as e:
raise Exception("Oops. Illegal graph received (exception {}). Please report (unless you did something silly yourself)".format(e))
{% for TEST in TESTCASES %}
{{ TEST.testcode }}
{{ TEST.extra }}
{% if not loop.last %}
print(SEPARATOR)
{% endif %}
{% endfor %}]]></template>
<iscombinatortemplate>1</iscombinatortemplate>
<allowmultiplestdins>0</allowmultiplestdins>
Expand Down

0 comments on commit 31658d8

Please sign in to comment.