-
Notifications
You must be signed in to change notification settings - Fork 0
Grading
Nelson Lojo edited this page May 3, 2023
·
3 revisions
If writing a Python or Ruby FPP, we highly recommend using the respective generator to automatically produce the files necessary for the external autograders.
The element outputs:
- the student submission as a single string in
data["submitted_answers"]["student-parsons-solution"]
- rich data about the student's final submission state in
data["submitted_answers"]["submission-lines"]
,data["submitted_answers"]["starter-code-order"]
, anddata["submitted_answers"]["parsons-solution-order"]
- these provide the lines and associated metadata that the student submitted, left in the source tray, and put in the submission tray respectively
- note that
student-parsons-solution
is the data itself, whereassubmission-lines
andparsons-solution-order
is are strings that when escaped evaluate to JSON that contain their data.
- a 'file' (i.e. an entry in
data["submitted_answers"]["_files"]
) nameduser_code.py
that has the contents ofdata["submitted_answers"]["student-parsons-solution"]
in the (prairielearn standard) base64 format.
Example of data["submitted_answers"]
:
{
"_files":[
{
"name":"user_code.py",
"contents":"aXQgJ2ZhaWxzIHdpdGggbmVnYXRpdmUgYmFsYW5jZScgZG9cbiAgICBleHBlY3QgeyBHaWZ0Q2FyZC5uZXcoLTEpIH0udG8gcmFpc2VfZXJyb3Ioc3R1ZGVudEZpbGxlZENvbnRlbnQpXG5lbmRcbml0ICdzdWNjZWVkcyB3aXRoIHBvc2l0aXZlIGJhbGFuY2UnIGRvXG4gICAgZ2lmdF9jYXJkID0gR2lmdENhcmQubmV3KDIwKVxuICAgIHN0dWRlbnRGaWxsZWRDb250ZW50KGdpZnRfY2FyZC5iYWxhbmNlKS50byBzdHVkZW50RmlsbGVkQ29udGVudCgyMClcbmVuZFxu=="
}
],
"submission-lines":[
{
"index":0,
"indent":0,
"content":"it 'fails with negative balance' do",
"segments":{
"blank_values":[
],
"given_segments":[
"it 'fails with negative balance' do"
]
}
},
{
"index":1,
"indent":1,
"content":" expect { GiftCard.new(-1) }.to raise_error(studentFilledContent)",
"segments":{
"blank_values":[
"studentFilledContent"
],
"given_segments":[
"expect { GiftCard.new(-1) }.to raise_error(",
")"
]
}
},
{
"index":2,
"indent":0,
"content":"end",
"segments":{
"blank_values":[
],
"given_segments":[
"end"
]
}
},
{
"index":3,
"indent":0,
"content":"it 'succeeds with positive balance' do",
"segments":{
"blank_values":[
],
"given_segments":[
"it 'succeeds with positive balance' do"
]
}
},
{
"index":4,
"indent":1,
"content":" gift_card = GiftCard.new(20)",
"segments":{
"blank_values":[
],
"given_segments":[
"gift_card = GiftCard.new(20)"
]
}
},
{
"index":5,
"indent":1,
"content":" studentFilledContent(gift_card.balance).to studentFilledContent(20)",
"segments":{
"blank_values":[
"studentFilledContent",
"studentFilledContent"
],
"given_segments":[
"",
"(gift_card.balance).to ",
"(20)"
]
}
},
{
"index":6,
"indent":0,
"content":"end",
"segments":{
"blank_values":[
],
"given_segments":[
"end"
]
}
}
],
"starter-code-order":"[]",
"parsons-solution-order":"[{\"content\":\"it 'fails with negative balance' do\",\"indent\":0,\"index\":0,\"segments\":{\"given_segments\":[\"it 'fails with negative balance' do\"],\"blank_values\":[]}},{\"content\":\" expect { GiftCard.new(-1) }.to raise_error(studentFilledContent)\",\"indent\":1,\"index\":1,\"segments\":{\"given_segments\":[\"expect { GiftCard.new(-1) }.to raise_error(\",\")\"],\"blank_values\":[\"studentFilledContent\"]}},{\"content\":\"end\",\"indent\":0,\"index\":2,\"segments\":{\"given_segments\":[\"end\"],\"blank_values\":[]}},{\"content\":\"it 'succeeds with positive balance' do\",\"indent\":1,\"index\":3,\"segments\":{\"given_segments\":[\"it 'succeeds with positive balance' do\"],\"blank_values\":[]}},{\"content\":\"gift_card = GiftCard.new(20)\",\"indent\":0,\"index\":4,\"segments\":{\"given_segments\":[\"gift_card = GiftCard.new(20)\"],\"blank_values\":[]}},{\"content\":\"studentFilledContent(gift_card.balance).to studentFilledContent(20)\",\"indent\":1,\"index\":5,\"segments\":{\"given_segments\":[\"\",\"(gift_card.balance).to \",\"(20)\"],\"blank_values\":[\"studentFilledContent\",\"studentFilledContent\"]}},{\"content\":\"end\",\"indent\":0,\"index\":6,\"segments\":{\"given_segments\":[\"end\"],\"blank_values\":[]}}]",
"student-parsons-solution":"it 'fails with negative balance' do\n expect { GiftCard.new(-1) }.to raise_error(studentFilledContent)\nend\nit 'succeeds with positive balance' do\n gift_card = GiftCard.new(20)\n studentFilledContent(gift_card.balance).to studentFilledContent(20)\nend\n"
}