Skip to content

Write a Boolean answer as 1 or 0, compared as a string - #97

Open
peterbjohnson wants to merge 1 commit into
mainfrom
boolean-as-number
Open

peterbjohnson wants to merge 1 commit into
mainfrom
boolean-as-number

Conversation

@peterbjohnson

Copy link
Copy Markdown
Member

Boolean areas built on Lambda Feedback mark correctly. Boolean areas exported by in2lambda don't.

When the platform runs a Boolean area's teacher test, it sends isExactEqual the following:

  • answer: 1
  • submission: 1
  • gradeParams: {type: "str"}

in2lambda wrote "answer": true and "gradeParams": null. So a student's 1 was compared with true, and the evaluation function had no type to cast them to. The platform's response area code (TrueFalse in the response area sandbox) also saves the answer, and sends each student's choice, as 1 or 0.

  • The Python API keeps bool. In the JSON, a Boolean area's answer and its test payloads are written as 1 or 0.
  • gradeParams for a Boolean area default to {"type": "str"}, with any grade_params the author sets merged over them. This is how NumericUnits adds physical_quantity.

Not yet checked by importing a set to the platform and running its teacher test.

🤖 Generated with Claude Code

Lambda Feedback's own teacher test of a Boolean area sends isExactEqual
answer 1, submission 1 and gradeParams {type: "str"}. in2lambda wrote
the answer as true and no gradeParams, so a correct response of 1 never
matched. The Python API keeps bool; the JSON now holds 1 or 0, for the
answer and test payloads, with type "str" unless the author sets it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant