openlab-at-city-tech / webworkqa

WeBWorK integration for WordPress and BuddyPress
GNU General Public License v2.0
4 stars 2 forks source link

Math notation not rendering consistently in problems on OLdev #44

Closed bree-z closed 8 years ago

bree-z commented 8 years ago

When I Ask a Question from WW, the math notation doesn’t render on the the OLdev site, only the plain text part of the problem appears (e.g. “Simplify the complex fraction” appears but the fraction doesn’t.) This happens when logged in as student or faculty user.

cantseeproblem_nopreviousquestions

When there have been previous questions about a problem, the math notation does appear, but, after I ask my question, it does not appear down at the bottom of the page. Also, if I view my question as another user, I see the same thing.

cantseeprobleminnewlypostedquesiton

URLs:

WW: http://mathww.citytech.cuny.edu/webwork2/WW-Dev/ComplexFractions-Method2/16777216/?effectiveUser=student1&user=student1&key=aOsYUHoPX6oLn0pVto9ljYhU2dsRWFBJ

OLdev: http://openlabdev.org/webwork-playground/#/problem/local/ComplexFractions-Method2/single-binomial-easy.pg

another example:

WW: http://mathww.citytech.cuny.edu/webwork2/WW-Dev/ComplexFractions-Method2/67108864/?user=student1&effectiveUser=student1&key=aOsYUHoPX6oLn0pVto9ljYhU2dsRWFBJ

OLdev: http://openlabdev.org/webwork-playground/#/problem/local/ComplexFractions-Method2/separated-reduce-DoS-med.pg

boonebgorges commented 8 years ago

Thank you so much for the detailed report, @bree-z. I tracked down the problem to some work I did the other day in support of just-in-time problems. In order to support them, I needed to strip script tags more aggressively from WW content in certain cases. But I was too aggressive, in a way that broke LaTeX import. This should be fixed now, and is ready for testing.

bree-z commented 8 years ago

Thanks, @boonebgorges. I'm still not seeing the LaTeX come over in some instances. In the examples below, it was missing in the problem at the top, before I completed the question fields, but appeared below after I asked a question.

WW: http://mathww.citytech.cuny.edu/webwork2/WW-Dev/ComplexFractions-Method2/16777216/ OLdev: http://openlabdev.org/webwork-playground/#/problem/local/ComplexFractions-Method2/single-binomial-easy.pg

and

WW: http://mathww.citytech.cuny.edu/webwork2/WW-Dev/ComplexFractions-Method2/50331648/?key=itOe0pJwtu6eZT8T5WD60lHOsGOkvULb&effectiveUser=student1&user=student1 OLdev: http://openlabdev.org/webwork-playground/#/problem/local/ComplexFractions-Method2/separated-reduce-DoS-med.pg

Others were fine though, for example:

WW: http://mathww.citytech.cuny.edu/webwork2/WW-Dev/ComplexFractions-Method2/33554432/?user=student1&effectiveUser=student1&key=itOe0pJwtu6eZT8T5WD60lHOsGOkvULb OLdev: http://openlabdev.org/webwork-playground/#/problem/local/ComplexFractions-Method2/separated-reduce-mono-easy.pg

Here's a screenshot of the first example (ComplexFractions-Method2, Problem 1):

nolatex

boonebgorges commented 8 years ago

Thanks for the screenshots, @bree-z. I've looked into it, and I believe what you're seeing here is the result of an old import that was botched in the manner described above. The problem text that appears at the top of the single-problem view - as seen in your most recent screenshot - is generated as follows:

if ( this is a post that comes directly from WW ) {
    show the problem text directly from WW
} elseif ( the current user has already asked a question related to this problem ) {
    show the problem text associated with the user's question
} else {
    show the problem text associated with the *oldest* question belonging to the current problem
}

In the cases you've described, you're falling through to the last else clause. And in this case, the oldest question for a given problem was created before I fixed the bug yesterday.

To verify, you can try to find a WW problem that doesn't yet have any questions on OL; Ask For Help and post a question; then, as a different user, view the OL problem page. This will cause you to fall through to the else clause above, and you should see the LaTeX. (I could also clear out old content, but I don't know if that will mess up your testing - let me know if that's what you'd prefer.)

bree-z commented 8 years ago

Aha, got it. Thanks for the explanation, @boonebgorges.

I tested as student1/teststudent with a problem that had no previous questions on the OL, and viewed it as teststaff. Everything looks good!

WW: http://mathww.citytech.cuny.edu/webwork2/WW-Dev/ShiftingParabolas/5/?effectiveUser=student1&user=student1&key=rk3VEJORElEE07y9aqqcbQ8SqFM64MLn OL: http://openlabdev.org/webwork-playground/#/problem/local/ShiftingParabolas/shift-up-leftOrRight.pg

If I should have done anything differently though, let me know and I can retest.

boonebgorges commented 8 years ago

Sounds perfect, @bree-z. Thank you!