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

Widget to customize number of seeds to generate #79

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rhinopotamus
Copy link

This commit makes a new IntText widget on the dashboard so you can customize the number of seeds to generate.
The value of this widget passes into output.generate_exercises(), which now has a new signature including an amount to generate.
generate_exercises() feeds this value to the sage command in wrapper/__init__.py, and the indexing of sys.argv in wrapper.sage is modified accordingly.

(Please feel free to ignore the version number change in checkit/__init__.py -- I put that in there so I could make sure I was using the local dev copy of dashboard instead of the global one.)

Copy link
Owner

@StevenClontz StevenClontz left a comment

Choose a reason for hiding this comment

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

Looks good at a glance, modulo my notes. I'd be happy to incorporate this in a new release.

dashboard/checkit/dashboard.py Outdated Show resolved Hide resolved
dashboard/checkit/outcome.py Outdated Show resolved Hide resolved
dashboard/checkit/outcome.py Outdated Show resolved Hide resolved
dashboard/checkit/wrapper/__init__.py Outdated Show resolved Hide resolved
dashboard/checkit/wrapper/__init__.py Outdated Show resolved Hide resolved
dashboard/checkit/__init__.py Outdated Show resolved Hide resolved
Copy link
Owner

@StevenClontz StevenClontz left a comment

Choose a reason for hiding this comment

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

This seems about ready. (I don't have a test suite like I should, but if it's working for you...)

If you want to be super cool, since you have a working dev environment and I actually don't right now, I can set you up to push a release candidate to PyPI, and if that works successfully I wouldn't mind letting you make the full release.

@@ -50,7 +50,8 @@ def to_dict(self,regenerate=False):

def preview_exercises(self):
preview_json = os.path.join(self.build_path(),"preview.json")
sage(self,preview_json,preview=True,images=True)
# hardcode: previews generate 10 seeds
sage(self,preview_json,amount=10,preview=True,images=True)
Copy link
Owner

Choose a reason for hiding this comment

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

amount=10 will be ignored by the sage script (see next comment)

Copy link
Author

Choose a reason for hiding this comment

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

Ok, yep, this works. (I was worried that the signature wouldn't match but it's ok because we handle a default amount in wrapper/init.py.)

@@ -206,15 +206,15 @@ if len(sys.argv) >= 4:
if sys.argv[3].lower() == "preview":
Copy link
Owner

Choose a reason for hiding this comment

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

here we ignore the amount if we're set to "preview". So I think it's better to simply omit the amount=10 earlier as it's misleading (it will use the default 1000 instead, but that's happily ignored here).

OR previews could support variable #s of seeds (maybe you really want to preview just 1 seed, or 100). But that's more work for minimal benefit?

@rhinopotamus
Copy link
Author

rhinopotamus commented Jul 24, 2023 via email

@StevenClontz
Copy link
Owner

No rush - I'm happy to help you make a 0.2.7 release with this feature if that's more convenient for you, or do it myself once someone else makes the same request.

@rhinopotamus
Copy link
Author

rhinopotamus commented Jul 27, 2023 via email

@StevenClontz
Copy link
Owner

Ah. That's caused by using non-standard Jupyter that CoCalc supported, but probably not JupyterLab et al. Let me see something...

@StevenClontz
Copy link
Owner

My hunch is that changing the \(, \), \[, \] at https://github.com/StevenClontz/checkit/blob/main/dashboard/checkit/static/html.xsl#L96 to $ and $$ as appropriate will fix the Jupyter notebook stuff. What's unclear offhand is whether that might break the CheckIt viewer app. So you could give that a try and report back.

@rhinopotamus
Copy link
Author

Unfortunately that change in html.xsl is no immediate dice.
I wonder if jupyter "knows" that there is html (and thus mathjax) inside that output cell, or if we have to tell it so in some fancy way.

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.

2 participants