Skip to content

feat: add subtract operation for number state variables#445

Open
leowla wants to merge 1 commit into
masterfrom
vps-145-subtract-operation-for-state-variables
Open

feat: add subtract operation for number state variables#445
leowla wants to merge 1 commit into
masterfrom
vps-145-subtract-operation-for-state-variables

Conversation

@leowla

@leowla leowla commented Jul 13, 2026

Copy link
Copy Markdown
Member

Issue

Users expect a subtract operation when "add" exists and sometimes confuse "set" for "add".

Solution

Add a subtract option

Risk

Low

Checklist

  • Acceptance criteria met
  • Wiki documentation is written and up to date
  • Continuous integration build passing

Summary by CodeRabbit

  • New Features
    • Added subtraction operations for numeric state variables.
    • Numeric values can now be decreased by a specified amount.
    • Existing set and add operations remain available; string and boolean behavior is unchanged.

@leowla leowla self-assigned this Jul 13, 2026
@leowla leowla added the enhancement New feature or request label Jul 13, 2026
@linear

linear Bot commented Jul 13, 2026

Copy link
Copy Markdown

VPS-145

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Backend and frontend state variable modules add a SUBTRACT operation, permit it for numeric state variables, and decrement matching values during operation application.

Changes

Numeric State Subtraction

Layer / File(s) Summary
Operation contracts
backend/src/util/statevariables/stateTypes.js, frontend/src/components/StateVariables/stateTypes.js
Adds SUBTRACT and permits it for NUMBER state variables while leaving string and boolean operations unchanged.
Subtraction execution
backend/src/util/statevariables/stateOperations.js, frontend/src/components/StateVariables/stateOperations.js
Applies subtraction by decrementing the matched state variable’s current value.

Estimated code review effort: 2 (Simple) | ~5 minutes

Suggested reviewers: harbassan, hazikchaudhry

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly states the main change: adding a subtract operation for number state variables.
Description check ✅ Passed The description covers Issue, Solution, Risk, and most of the checklist, but omits unit and integration test items.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch vps-145-subtract-operation-for-state-variables

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@harbassan harbassan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

easy enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants