-
-
Notifications
You must be signed in to change notification settings - Fork 167
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
PG Problem Editor file selector #2677
PG Problem Editor file selector #2677
Conversation
I forgot to mention that I made the editor NOT show the "Append form for a new blank problem as it was before. That is because that doesn't work. If you use it, it adds the path |
I'm getting the following error:
I think you mean to import "getSampleProblemCode". |
1ca3725
to
9d832a6
Compare
Oops. I changed the method name on the PG side at some point and forgot to change it here also. |
This works now. Seems like the workflow to use the sample problems in the editor is to
We were discussing the ability to have a link (or button) on the Sample Problem page to take you to the problem editor. Did this not work well? |
I mentioned last week that a link on the sample problem page to the editor is challenging because you don't even have a course name on that page. I thought about it a little more, and I don't think it is even possible to do. I don't think that having a course name is even enough, and getting that in is a messy hack to begin with. |
I know we had talked about this. Maybe we can add some help to the sample problems to explain how to use the problem editor to get the problem. Also, I'm thinking we might be able to add an option on the "Save As" in the Problem Editor to append to an existing set to simplify a bit more. Neither of these should be part of this PR, just brainstorming. |
This changes the PG Problem Editor to not assume a file type when opened without a file type specified. So when the problem editor is opened from the site navigation link it does not directly open to the blank file template. Instead it opens to a file chooser page. On that page, three options are presented. The user may choose a "New Problem Template", a "File" and give a path relative to the course templates directory, or a "Sample Problem" and pick a sample problem file from a dropdown. In order to support sample problems a new file type needed to be implemented for the problem editor. The sample problem parsing module for PG is used to strip out the documentation when the problem is loaded into the editor. However, I observed that the current code for that used by the sample problem viewer to offer a sample problem file for download is highly innefficient. It currently reads all of the sample problem files, then reads all of the PG macros, and then parses the desired problem stripping out documentation, and finally serves the file. So a corresponding PG pull request adds a `getSampleProblemCode` method that simply reads only the desired sample problem and efficiently strips out the documentation without needing the macros and sample problem metadata. So instead of needing to read 253 files (the number of macros plus the number of sample problems currently), it only reads 1.
9d832a6
to
bb23dbc
Compare
This is great. I'm just going to mention a thought, and defer to @drgrice1 about if it would be worth pursuing. What if there were a fourth option when you go to the Editor, that is basically like the File Manager? So you could browse files, enter folders, and then select a file to edit? It would be redundant, since you can also just go to File Manager if that's what you want. It only occurs to be if I was of a mind to go edit a file in some folder in my course, and on autopilot, I might go to the Editor instead of the File Manager. And I might not be able to recall (or correctly type) the path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, even with the comment/question I just left.
I think that would be nice, and I also thought of something like that. I think that will take a bit more effort to achieve though. So perhaps that could be done in a future pull request. As I mentioned in the meeting last week, I think there are other possibilities for options on this page as well. Like opening a file on the user's local computer directly in the editor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good start and we can update the Problem Editor in a later PR.
As I mentioned I think we can do some other streamlining on the "Save As" tab as well.
This changes the PG Problem Editor to not assume a file type when opened without a file type specified. So when the problem editor is opened from the site navigation link it does not directly open to the blank file template. Instead it opens to a file chooser page. On that page, three options are presented. The user may choose a "New Problem Template", a "File" and give a path relative to the course templates directory, or a "Sample Problem" and pick a sample problem file from a dropdown.
In order to support sample problems a new file type needed to be implemented for the problem editor. The sample problem parsing module for PG is used to strip out the documentation when the problem is loaded into the editor.
However, I observed that the current code for that used by the sample problem viewer to offer a sample problem file for download is highly innefficient. It currently reads all of the sample problem files, then reads all of the PG macros, and then parses the desired problem stripping out documentation, and finally serves the file. So the PG pull request openwebwork/pg#1198 adds a
getSampleProblemCode
method that simply reads only the desired sample problem and efficiently strips out the documentation without needing the macros and sample problem metadata. So instead of needing to read 253 files (the number of macros plus the number of sample problems currently), it only reads 1.To test this make sure to check out openwebwork/pg#1198.