Calc module changes: previewing and <formulaequationinput> - #512
Conversation
There was a problem hiding this comment.
What is thing? If thing is a tree call it tree. Just think this can be a bit more descriptive variable name.
|
Did a VERY brief once-over. I think generally this is good but there'll be a bit to clean up. Also some unit tests are failing. Hopefully some others can take passes at this and I'll return and give it a more thorough review throughout this week. |
There was a problem hiding this comment.
Why do we need an except clause here? The exception is caught and turned into a test failure. Why not just let the exception fly and become an error result? Then you wouldn't need to pragma the except.
There was a problem hiding this comment.
It was to provide a better error message on failure, but you could say it has enough context already for people to understand what's going on.
There was a problem hiding this comment.
Yeah, once you need to pragma the code, you should think a few times about why we have code that isn't run.
|
I would like to have working example in repository, please add example to content-demos repository (https://github.com/MITx/content-demos), so we can look at it "live" |
There was a problem hiding this comment.
why not (here and above):
varname = tokens[0][0]
if self.case_sensitive:
varname = varname.lower()
|
@vaxXxa will review python part. |
|
@polesye will look at front-end part on Monday. |
There was a problem hiding this comment.
Instead of having the else clause you can just initialize suffix = "" before the if
|
Take a look at the pep8/pylint violations and clean up things in code you have touched. |
|
There is a broken icon that shows up briefly when I first render the problem in Studio or type a formula in the text field. Also, as discussed with Peter, the error messaging/format needs work ("extCouldn′tparseformula:"). |
There was a problem hiding this comment.
Also these are suffixes not prefixes, right?
- Create a method called `parse_algebra`. It takes a string of math and returns with a `pyparsing.ParseResults` object representing it. - `evaluator` takes this tree and applies the old "parse actions" to it to get the same number as it used to. - Change calc's API: `evaluator` to use `case_sensitive` rather than `cs` - Add most of the capability for latex rendering
Named `FormulaEquationInput` (name up for debate) - Based off ChemEqnIn - Add FormulaEquationInput in inputtypes.py - Add a call to a skeleton method for a preview javascript: - Queue up some MathJax - Put some ordering on the AJAX requests: add a parameter when the request was started, when it returns check that it isn't outdated before displaying the preview - Tests Note: we moved the `jsinput` tests and DISABLED them, because they were causing the tests to fail.
|
|
Calc module changes: previewing and <formulaequationinput> To see individual commits, see tag peterb/formula-preview/presquash
fixed recent threads & tags links
Remove south table shortening call.
…01-squashed Django 1.8 merge from upstream release 2015-12-01
The identityserver class provided by Open edX was overriding our custom header definitions by initializing an empty header object We now add our own custom auth headers (User-Agent) to the authentication APIs to comply with wikimedias user-agent policy
How to see it
Make a "Numerical Input" or "Advanced > Math Expression Input" problem in studio. By default, it should use the new input type.
Alteratively add a
<formulaequationinput/>to a<numericalresponse>or<formularesponse>in some problem XML.Also, if you have the
content-demoscourse in your setup, checkout thepeterb/formula-eq-inputbranch, and navigate to the 'Formula Equation Input' sequential.Changes (in brief)
evaluatorincalc.pyworks.latex_previewto take a tree and give a latex string representing it.formulaequationinputwith associated javascript that callslatex_previewon user input.Reviewers