cmusv / pysheetgrader-core

PySheetGrader -- grading spreadsheet assignments made easy!
Other
2 stars 2 forks source link

In formula, check, and relative rubric types, less-than-or-equal ( >= ) and greater-than equal ( <= ) signs give a syntax error in a boolean formula #31

Open erdogmush opened 2 years ago

erdogmush commented 2 years ago

Example: =C4 <= C3

This was noticed in the check rubric type originally (check tab RCheck in the TestModeKey.xlsx), but it probably applies to formula and relative rubric types as well, any rubric type that evaluates a formula in python.

erdogmush commented 2 years ago

Added a test to RRelative tab of TestModeKey.xlsx about >= but it crashes the grader because of the syntax error, so the test is disabled in CheckOrder sheet. Once fixed add this test back to RRelative_CheckOrder

erdogmush commented 2 years ago

This bug is caused by the naive treatment of formulas that replaces all equal signs in Excel formulas with == to be convert them to equality comparison in Python. How could the student who implemented this not think of this or not tested this? Sheer rookie mistake!

erdogmush commented 1 year ago

See: https://github.com/cmusv-svvt/pysheetgrader-obsolete/issues/62#issue-953170470

colelloa commented 1 year ago

issue was due to the excel formulas adding == as mentioned earlier. issue fixed in formula_parser with an aggressively simple (perhaps too simple?) string hack

    expanded_form = expanded_form.replace('<==', '<=').replace('>==', '>=')