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

exercise2 extension cells showing up in some notebooks but not others #1079

Closed
satra opened this issue Sep 4, 2017 · 5 comments · Fixed by #1206
Closed

exercise2 extension cells showing up in some notebooks but not others #1079

satra opened this issue Sep 4, 2017 · 5 comments · Fixed by #1206

Comments

@satra
Copy link

satra commented Sep 4, 2017

we have a set of notebooks with exercise2 extensions enabled. in a jupyter-hub setting or when running these through a docker container, these extension enabled cells show up in some of these notebooks but not others even though the metadata exists in the json file.

in fact in a git repo, i can use the rubberband + exercise to re-enable the view, but it doesn't make any change to the json file (since the metadata is already there).

we are wondering if this intermittent behavior has been observed before.

@dkirkby
Copy link

dkirkby commented Jan 18, 2018

I am seeing the same behavior with exercise2, but I have noticed that it correlates with longer notebooks and that the "Show Solution" widgets reappear if I delete enough cells.

I haven't tried using exercise (as opposed to exercise2) but do you know if this behavior is unique to exercise2?

@dkirkby
Copy link

dkirkby commented Jan 18, 2018

@jcb91 Is this the right place to post exercise2 issues?

@jcb91
Copy link
Member

jcb91 commented Jan 19, 2018

@satra apologies, I've only just noticed this issue! @dkirkby Sure, this is the right repo for exercise/2 issues. Both exercise and exercise2 use an almost identical codebase, the only real difference is in the controls they provide (checkbox vs toggle switch), so it's unlikely that the behaviour is unique to one of them. Essentially, I think that this issue stems form the fact that both extensions only set the initial visibility of exercise solutions once, when the nbextension loads. For small notebooks, this is after the notebook has loaded, so all is well. For larger notebooks, this can happen before all cells in the notebook load, and any that load after the nbextension won't get their exercises displayed correctly. It should be easy to fix, so I'll try to patch this soon.

@dkirkby
Copy link

dkirkby commented Jan 19, 2018

Thanks for looking into this @jcb91! I am using exercise2 for in-class activities in a course right now, so happy to test any patch.

@jfbercher
Copy link
Member

You are right @jcb91. I thought that the test for notebook_fully_loaded was already implemented but it is not indeed, so the observed behaviour!
Indeed the fix is easy as we know.
The display existing solution section should be transformed into a function and called at initialization after the "wait for notebook loaded" test.

The source is quite old now, and looking at it, it could also undergo a small lifting.

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 a pull request may close this issue.

4 participants