Skip to content
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

Add allowScalingCoefficents option to Chemistry checker #646

Merged
merged 4 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class IsaacSymbolicChemistryQuestion extends IsaacSymbolicQuestion {
@JsonProperty("isNuclear")
private boolean isNuclear;
private boolean allowPermutations;
private boolean allowScalingCoefficients;

/**
* @return whether the question is a nuclear question or not
Expand All @@ -58,4 +59,16 @@ public void setNuclear(boolean nuclear) {
public void setAllowPermutations(boolean allowPermutations) {
this.allowPermutations = allowPermutations;
}

/**
* @return whether the question allows coefficients to be multiplied e.g. 10 H2 + 5 O2 -> 10 H2O
*/
public boolean getAllowScalingCoefficients() { return allowScalingCoefficients; }

/**
* @param allowScalingCoefficients set whether the question allows coefficients to be multiplied e.g. 10 H2 + 5 O2 -> 10 H2O
*/
public void setAllowScalingCoefficients(boolean allowScalingCoefficients) {
this.allowScalingCoefficients = allowScalingCoefficients;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class IsaacSymbolicChemistryQuestionDTO extends IsaacSymbolicQuestionDTO
@JsonProperty("isNuclear")
private boolean isNuclear;
private boolean allowPermutations;
private boolean allowScalingCoefficients;

/**
* @return whether the question is a nuclear question or not
Expand All @@ -52,4 +53,16 @@ public void setNuclear(boolean nuclear) {
public void setAllowPermutations(boolean allowPermutations) {
this.allowPermutations = allowPermutations;
}

/**
* @return whether the question allows coefficients to be multiplied e.g. 10 H2 + 5 O2 -> 10 H2O
*/
public boolean getAllowScalingCoefficients() { return allowScalingCoefficients; }

/**
* @param allowScalingCoefficients set whether the question allows coefficients to be multiplied e.g. 10 H2 + 5 O2 -> 10 H2O
*/
public void setAllowScalingCoefficients(boolean allowScalingCoefficients) {
this.allowScalingCoefficients = allowScalingCoefficients;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ public QuestionValidationResponse validateQuestionResponse(final Question questi
req.put("test", submittedFormula.getMhchemExpression());
req.put("description", chemistryQuestion.getId());
req.put("allowPermutations", String.valueOf(chemistryQuestion.getAllowPermutations()));
req.put("allowScalingCoefficients", String.valueOf(chemistryQuestion.getAllowScalingCoefficients()));
req.put("questionID", question.getId());

if (chemistryQuestion.isNuclear()) {
Expand Down
Loading