Summary

  • Exercises used one of these three methods to grade student’s submissions, namely match, regex, and insert.
  • The answers for each exercise have different data schemas depending on the grading method.


Grades

Data Schema

{
    "data": [],
    "_id": VARCHAR,
    "language_id": 71,
    "method": ENUM
    
    /* Additional fields depends on 'method' */
}

Key definitions

  • 🔑 _id: see Lesson ID
  • 🔑 language_id: 71 - denotes code language Python
  • 🔑 method: match | insert | regex. See Grading Methods
  • 🔑 data: answers and possibly assertation python statements (questions that verify variable’s value)

Grading Methods

match

Used to grade

Example: Multiple-choice Exercise
{
    "_id": "G0000",
    "method": "match",
    "data": [
        "Yes"
    ],
}

_idpayloadanswerchoices
G0000Python is a programming language?YesYes ~ No

Example: Drag-and-Drop Exercise
{
    "_id": "G1020",
    "data": [
        "*"
    ],
    "method": "match",

_idpayloadcardsanswer
G1020I want to get 60 from these ints, which operator do I use? Drag and drop the correct operator into the equation.+-*/**~%*
textTypetextValue
text12
input
text5 = 60

Example: True/False Exercise
{
    "_id": "G2195",
    "data": [
        "false"
    ],
    "method": "match",
}

_idpayloadanswer
G2195product = “Soap “\nprice = 10false

insert

Used to grade

Example: Code Input Exercise
{
    "_id": "G2114",
    "expected_output": null,
    "expected_answer": [
        "name, gender, age, birthday = \"Evelyn\", \"female\", 31, \"03\""
    ],
    "stdin": null,
    "data": [
        "",
        "\nassert name == 'Evelyn'\nassert gender == 'female'\nassert age == 31\nassert birthday == '03'"
    ],
    "language_id": 71,
    "method": "insert",
}

_idpayloadhasSecondColumninitialCodenoOutput
G2114The mayor of Gummy Village wants his citizens to register their name, gender, age and birth month in their database. Help the citizens register their details by filling in the blanks with the correct variable names and values.

Evelyn is a 31-year-old woman living in Gummy Village. She was born on the 24th of March and loves to do gardening.

Fill in the blanks below with the correct information, where the parentheses are not included in the actual code.

Note: The birth month is represented as a string with two digits, so “01” for January.
falseSee below
G2114-initialCode
[            ], gender, age, birthday = "Evelyn", "female", [            ], [            ]

regex

Used to grade

Example: Fill-in-the-blank Exercise
{
    "_id": "G1026",
    "method": "regex",
    "expected_answers": [
        "2 + 6",
        "8 % 5"
    ],
    "data": [
        "2\\s*\\+\\s*6",
        "8\\s*\\%\\s*5"
    ],
}

_idpayloadanswer
G1026A farmer has traded his vegetables to many customers. In return, the customers must give him seeds to complete the trade. The farmer has used equations to keep track of who owes how many seeds. He wants you to match the equations to the correct customer.

Write equations for the following people in the list below.

- Timmy owes two plus six
- Jim owes the remainder of eight divided by five

Write your equations in the space provided.
2 + 6~8 % 5
textArrayIndextextTypetextValue
0texttimmy =
0input
1textjim =
1input

APIs (Testing)

Get the answer

  • Response: {exercise-answer}

Post an Answer

method= [ match, regex, insert\ ]

  • Request Body: {exercise-answer}
  • Response: {exercise-answer}

Delete an Answer

  • Request Body:
{
	"_id": "exercise_id"
}
  • Response: {exercise-answer}