Fix crop residue visibility condition and calculations#569
Conversation
…residues yielded zero supply; it now correctly calculates supply for residues that are not explicitly removed.
…ation category (`b_lu_croprotation === 'cereal'`) and ensure its default value is `undefined` when hidden.
|
👋 Hotfix Branch PR Detected! Before merging this Pull Request into This will:
You can trigger the workflow from the 'Actions' tab, selecting the 'Release' workflow, and choosing this |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (4)
📝 WalkthroughWalkthroughThis PR fixes crop residue visibility and calculation logic by conditionally showing the "Gewasresten achterlaten" checkbox only for cereal crops based on Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
fdm-calculator/src/balance/organic-matter/supply/residues.ts (1)
39-42: Keep the function JSDoc in sync with the new!== falselogic.Implementation now treats
undefinedas “residues left,” but the top doc still implies onlytruequalifies. Please update the doc text to avoid future confusion.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@fdm-calculator/src/balance/organic-matter/supply/residues.ts` around lines 39 - 42, Update the JSDoc to reflect the actual logic: state that residues are considered left unless cult.m_cropresidue is explicitly false (i.e., undefined or true are treated as residues left), and that cultivationDetail.b_lu_eom_residue must be present (not null/undefined) to trigger residue handling; reference the variables cultivationDetail?.b_lu_eom_residue and cult.m_cropresidue in the doc so future readers understand the !== false check and the != null requirement.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@fdm-calculator/src/balance/organic-matter/supply/residues.ts`:
- Around line 39-42: Update the JSDoc to reflect the actual logic: state that
residues are considered left unless cult.m_cropresidue is explicitly false
(i.e., undefined or true are treated as residues left), and that
cultivationDetail.b_lu_eom_residue must be present (not null/undefined) to
trigger residue handling; reference the variables
cultivationDetail?.b_lu_eom_residue and cult.m_cropresidue in the doc so future
readers understand the !== false check and the != null requirement.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: fc25d04f-de1a-493b-b6d1-4f2a138cdf27
📒 Files selected for processing (7)
.changeset/fix-fdm-app-m-cropresidue.md.changeset/fix-fdm-calculator-m-cropresidue.mdfdm-app/app/components/blocks/cultivation/card-details.tsxfdm-app/app/components/blocks/rotation/columns.tsxfdm-calculator/src/balance/nitrogen/removal/residue.test.tsfdm-calculator/src/balance/organic-matter/supply/residues.test.tsfdm-calculator/src/balance/organic-matter/supply/residues.ts
|
@coderabbitai resume |
✅ Actions performedReviews resumed. |
Summary by CodeRabbit
Bug Fixes
Tests
Closes #568