Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Answer classes for export in problem.sty #401

Closed
kohlhase opened this issue Sep 14, 2023 · 4 comments
Closed

Answer classes for export in problem.sty #401

kohlhase opened this issue Sep 14, 2023 · 4 comments
Assignees

Comments

@kohlhase
Copy link
Contributor

kohlhase commented Sep 14, 2023

Answerclasses currently have the attributes id, pts, and schema, they also need the feedback attribute, so that we can write

 \answclass[id=foo,feedback=bar,pts=2]{answer class description}

for the answer class awarding 2 points by default, and providing the feedback bar.
Here is a complete example, it is also at https://gl.mathhub.info/MiKoCourses/krmt/-/blob/main/source/SS23/probex.en.tex:

\begin{sproblem}[id=foo,title=FOO]
  consider the following situation
  \begin{subproblem}[id=foo:first,title=First subproblem,pts=2]
    find a Bar here
    \begin{solution}
      here it is 
    \end{solution}
    \begin{gnote}
      that was easy
      \anscls[id=nf,pts=0,feedback=try harder]{not found}
      \anscls[id=downtown,pts=1,
        feedback={that was already good, but we want a street address}]
        {only specifies there are lots downtown}
      \anscls[id=streetaddress,pts=2]{gives a street address}
      \anscls[id=directions,pts=2]{gives directions to walk there}
    \end{gnote}
  \end{subproblem}
\end{sproblem}

This should export the JSON (see https://gl.mathhub.info/MiKoCourses/krmt/-/blob/main/source/SS23/probex.json:

{"type":"sproblem",
 "id":"foo",
 "title":"FOO",
 "subproblems":[
     {"id":"foo:first",
      "title":"First subproblem",
      "pts":2,
      "gnote":{"text":"that was easy",
	       "anscls": [
		   {"id":"nf",
		    "pts":0,
		    "feedback":"try harder"
		    "description":"not found"},
		   {"id":"downtown",
		    "pts":1,
		    "feedback":"that was already good, but we want a street address"
		    "description":"only specifies there are lots downtown"},
		   {"id":"streetaddress",
		    "pts":2,
		    "description":"gives street address"},
		   {"id":"directions",
		    "pts":2,
		    "description":"gives directions to walk there"}
	       ]
	      }
     }
 ]
}
@lambdaTotoro
Copy link

I think the information "type" : "sproblem" is not necessary. Same for ids for answer classes. You're likely to just reproduce (parts of) the description anyway. Default description, feedback and points is sensible, though.

That would lead to JSON looking something like this:

{
	"id" : "foo",
	"title" : "FOO",
	"subproblems" : [
		{
			"id" : "foo:first",
			"title" : "First subproblem",
			"pts" : 2,
			"gnote" : {
				"text":"that was easy",
				"anscls": [
					{
						"pts" : 0,
						"feedback" : "try harder",
						"description" : "not found"
					},
					{
						"pts" : 1.5,
						"feedback" : "that was already good, but we want a street address",
						"description" : "only specifies there are lots downtown"
					},
					{
						"pts" : 2,
						"description" : "gives street address"
					},
					{
						"pts":2,
						"description" : "gives directions to walk there"
					}
				]
			}
		}
	]
}

@Jazzpirate
Copy link
Contributor

Jazzpirate commented Sep 18, 2023

one caveat: "title", "feedback" and "description" are going to be HTML. Largely they should be "trivial" HTML in the sense of: maybe a div with some class that won't exist and can be ignored with plain text content. But I'm not in charge of what people put in there, so comple-latex-in-complex-HTML-out, I guess :D

@lambdaTotoro
Copy link

Actually, I've noticed I need a bit more information in the JSON. We use the numbers of exercises for correcting, so it would be helpful to have them included in the json. Otherwise, it's difficult to know if the third problem specified is "1.3" or if there's only "1.1" and "1.2" and this one is already "2.1"...

And because I was editing anyway, I also added some answer traits (as opposed to answer classes, see #404 if you can find it).

{
	"id" : "foo",
	"title" : "FOO",
	"number" : "2.1",
	"subproblems" : [
		{
			"id" : "foo:first",
			"title" : "First subproblem",
			"number" : "2.1.1",
			"pts" : 2,
			"gnote" : {
				"text":"that was easy",
				"anscls": [
					{
						"pts" : 0,
						"feedback" : "try harder",
						"description" : "not found"
					},
					{
						"pts" : 1.5,
						"feedback" : "that was already good, but we want a street address",
						"description" : "only specifies there are lots downtown"
					},
					{
						"pts" : 2,
						"description" : "gives street address"
					},
					{
						"pts":2,
						"description" : "gives directions to walk there"
					},
					{
						"pts" : "+0.5",
						"description" : "Student did better",
						"feedback" : "well done"
					},
					{
						"pts" : "-0.5",
						"description" : "Student did worse"
					}
				]
			}
		}
	]
}

@kohlhase
Copy link
Contributor Author

this is done, right?

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

No branches or pull requests

3 participants