Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Add: Dynamic questions. #1255

Closed
wants to merge 31 commits into from
Closed

Conversation

bjones1
Copy link
Contributor

@bjones1 bjones1 commented Sep 20, 2021

This improves fitb problems to support dynamic exercises, graded either on the client or on the server. It's based on discussions / collaboration between myself and Brian Walton.

Replaces #1225.

@bjones1 bjones1 marked this pull request as ready for review October 16, 2021 18:24
@bjones1
Copy link
Contributor Author

bjones1 commented Oct 16, 2021

Brian and I talked yesterday and agreed that this is ready for your review.

.github/workflows/python-package.yml Outdated Show resolved Hide resolved
@@ -18,6 +18,9 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to transpile back to ES5 ?? We already require a modern browser, or are there other reasons for using babel that I should be aware of??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the server-side code, I run JS in a Python emulator which only supports ES5. It runs a piece of the client-side code; I use webpack to transpile it as a part of the build.

node.runestone_options["client_json"] = client_json
outer_html = """
<div class="%(divclass)s">
<div data-component="fillintheblank" data-question_label="%(question_label)s" id="%(divid)s" %(optional)s style="visibility: hidden;">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, this really goes against the principle of creating simple html to represent a component. I think this will make it more difficult to integrate with PreTeXt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's definitely more complex, but ends up being just adding/removing JSON pieces. I don't know of a simpler form. For PreTeXt, it's possible to support just one flavor (client-side only, for example) to keep it simpler.

self.body.append(res)
if node_with_document.document.settings.env.config.runestone_server_side_grading:
if node.dynamic:
# Server-side graded dynamic problems render and provide the problem's HTML on the server; just tell the client it's a dynamic problem.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I'm following this. This will need a corresponding server PR to work correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's also a server-side PR. I can push that now if you'd like, or wait until this is merged. The server-side tests don't pass until this is merged, of course.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and pushed RunestoneInteractive/BookServer#83. I'm leaving it as a draft for now, in case I need to update it based on the conversation here.

# ]
#
# ...and a transformed node structure:
#
# .. code-block::
# :number-lines:
# :linenos:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was number-lines a mistake? Did this change? is this 4.x ? (we are not ready for 4.x yet)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was strange to me also. I'm using Sphinx 3.5.2 AFAIK. I'll check...

@@ -0,0 +1,940 @@
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these ejs files be here or npm installed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a modified version of ejs to work around some bugs / limitation of ejs, hence putting it here.

// *********
// |docname|
// *********
// ***********************************************
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might require a zoom meeting at some point to walk me through this. This is quite a complicated PR and I think either some high level written explanation to give me the big picture or a zoom would really help.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's quite complicated, but as simple as I know how to make it. I'd be happy to chat via Zoom. Let me know when you're free.

@bjones1
Copy link
Contributor Author

bjones1 commented Oct 19, 2021

I just merged in the latest changes from the peer_support branch.

@bjones1
Copy link
Contributor Author

bjones1 commented Dec 2, 2021

Closed in favor of #1278.

@bjones1 bjones1 closed this Dec 2, 2021
@bjones1 bjones1 deleted the dynp branch March 24, 2022 22:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants