Checcking Correctness from Math Input Inequality

I am putting together a review activity for my students. I have to proctor an exam, so I am trying my best to check for correctness so they will know if they are doing it right. I want my students to be able to represent an inequality with one variable and put it in a math input component.

I don’t want to restrict them to just using x (I did find a way to do that and maybe that is the way I need to go). I wrote the following to check and make sure they have a valid inequality. It checks to see if one side is a number and the other is not. This is flawed because they could but something like x + 2 and CL will flag this as not a number and say it is valid inequality.

Looking for suggestions on how to solve for this.

I would describe myself as a dabbler in the CL who is always trying to learn.

This is the code.

#left for debugging purposes - will show the latex if added as a label
inequality = “${Math2.latex}”

#items specific to the screen
mathInequality = Math2.script.inequality
checkNumber = 8
submitted = Math2.submitted

Grabbing the left and right side of the inequality from the math input

lhs = mathInequality.lhs
rhs = mathInequality.rhs

setting the lhs and rhs into a number variable

leftNumber = numericValue(lhs)
rightNumber = numericValue(rhs)

making sure the inequality has a variable on one side and a number of the other side

this was checked in Math1 and is flawed if the student puts in 2 < 2 +x because it will see a number of both sides

correctFormat = when submitted
(when ((isUndefined(leftNumber) and isDefined(rightNumber)) or (isDefined(leftNumber) and isUndefined(rightNumber)))
1 otherwise 2)
otherwise 0