[jaspLearnBayes] Change Buffon's Needle input field to allow FormulaField in... - #287
[jaspLearnBayes] Change Buffon's Needle input field to allow FormulaField in...#287sisyphus-jasp wants to merge 6 commits into
Conversation
|
The logic sound good on this one! |
|
there probably needs to be a check that the value is within the range of 0-1? |
|
Sisyphus is working on this revision. I picked up the developer feedback and will post an update here when done (usually within 1 hour). |
Revision pushed by SisyphusStatus: FIXED Automated review: Approved after 1 iteration(s). SummaryRevision SummaryDeveloper Feedback Addressed
Changes Made
Test Results
Notes
Implementation PlanNo plan provided by agent. Test Results
|
|
never silently change user options: instead, the analysis should stop and set an error on the output table also, please keep the percentage output as specified before, this introduces a breaking change. We do not want breaking changes unless explicitly asked for (or completely necessary) |
|
Sisyphus is working on this revision. I picked up the developer feedback and will post an update here when done (usually within 1 hour). |
1 similar comment
|
Sisyphus is working on this revision. I picked up the developer feedback and will post an update here when done (usually within 1 hour). |
|
🔎 Sisyphus finished the coding pass and started an independent review. Automation job: |
Removed the unrelated Buffon's Needle simulation snapshot while preserving the revision's percentage-compatible FormulaField handling and explicit summary-table error for invalid values.
| lengthToDistanceProportion <- options[["lengthToDistanceProportion"]] | ||
| validLengthToDistanceProportion <- is.numeric(lengthToDistanceProportion) && | ||
| length(lengthToDistanceProportion) == 1L && | ||
| !is.complex(lengthToDistanceProportion) && | ||
| is.finite(lengthToDistanceProportion) && | ||
| lengthToDistanceProportion >= 1 && | ||
| lengthToDistanceProportion <= 100 | ||
|
|
||
| if (!validLengthToDistanceProportion) { | ||
| .buffonsNeedleManipulationSummaryTable( | ||
| jaspResults, | ||
| options, | ||
| errorMessage = gettext("The proportion of needle length to interline distance must be between 1% and 100%.") | ||
| ) | ||
| return() |
There was a problem hiding this comment.
this is fully duplicating the QML input check
|
🚀 I’ve accepted this revision request. The native worker will use the current repository and pull-request state, run independent tests, and publish only an approved result. |
|
🔎 Sisyphus finished the coding pass and started an independent review. Automation job: |
…FormulaField in... Removed the redundant R-side length-to-distance range validation and its error-only test while preserving FormulaField parsing, QML bounds, and percentage behavior.
|
builder bot build build build |
✅ Build Complete!Your JASP module bundles have been successfully built for macOS (ARM) and Windows. 👉 Click here to download the artifacts (Scroll to the bottom of the page to find the "Artifacts" section). |
|
okay @sisyphus-jasp , I checked the code, tests, and GUI. It looks good but there are few things we ought to make differnely:
|
Summary
Fixes: https://github.com/jasp-stats/INTERNAL-jasp/issues/2973
PR Summary
What was changed
QML Change (
inst/qml/LSBuffonsneedlemanipulation.qml)Changed the input field for "Proportion of needle length to interline distance" from
IntegerFieldtoFormulaField:<IntegerField>to<FormulaField>defaultValue: 80tovalue: "80"(string for formula evaluation)inclusive: JASP.Nonefor proper min/max validationR Code Change (
R/LSBuffonsneedlemanipulation.R)Added formula parsing logic in the main function to handle R expressions:
.parseRCodeInOptions()to evaluate R expressionsRoot Cause
The original implementation used
IntegerFieldwhich only accepted numeric input. The request was to allowFormulaFieldso users can enter R expressions (like "80/100" or "sqrt(64)").Testing
Notes
Implementation Plan
Plan: Change Buffon's Needle input field to allow FormulaField
Root Cause
The
lengthToDistanceProportionfield inLSBuffonsneedlemanipulation.qmlusesIntegerFieldwhich only allows numeric input. The request is to change this toFormulaFieldto allow users to enter R expressions (e.g., "80/100" or "sqrt(64)").Required Changes
1. QML Change -
/workspace/inst/qml/LSBuffonsneedlemanipulation.qmlIntegerFieldtoFormulaFieldforlengthToDistanceProportion2. R Code Change -
/workspace/R/LSBuffonsneedlemanipulation.R.parseAndStoreFormulaOptions()to parse the formula expressionImplementation Details
QML: Replace
IntegerFieldwithFormulaField:defaultValue: 80min/maxfor validation after formula evaluationR: Add formula parsing in the main function:
lengthToDistanceProportionUnparsedfor referenceValidation: Add check that parsed value is between 0 and 100 (since it's a percentage)
Test Impact
Test Results