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 range operator in Remote Inbox Notification #45201

Merged
merged 9 commits into from Feb 29, 2024

Conversation

moon0326
Copy link
Contributor

@moon0326 moon0326 commented Feb 29, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes #44787

This PR adds range operation in Remote Inbox Notification to support testing a number's range. This PR also updates Remote Spec Validation schema files to support range

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Run unit tests and make sure they pass. ./vendor/bin/phpunit --testsuite shard2
  2. Install and activate WooCommerce Beta Tester
  3. Go to Tools -> WCA Test Helper -> Remote Spec Rule Validator
  4. Get the value of woocommerce_remote_variant_assignment option.
  5. Paste the following rule and adjust value for testing.
[
    {
        "type": "option",
        "option_name": "woocommerce_remote_variant_assignment",
        "value": [0, 10],
        "operation": "range"
    }
]

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Support range operator in Remote Inbox Notification

Comment

@moon0326 moon0326 requested review from a team, chihsuan and adrianduffell February 29, 2024 00:05
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Feb 29, 2024
@moon0326 moon0326 requested review from psealock and removed request for adrianduffell February 29, 2024 00:05
Copy link
Contributor

github-actions bot commented Feb 29, 2024

Hi @psealock, @chihsuan, @woocommerce/ghidorah

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@moon0326 moon0326 changed the title Add range rule in Remote Inbox Notification Add range operator in Remote Inbox Notification Feb 29, 2024
Copy link
Contributor

github-actions bot commented Feb 29, 2024

Test Results Summary

Commit SHA: 0ce4a35

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 38s
E2E Tests34300803517m 50s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

@moon0326 moon0326 closed this Feb 29, 2024
@moon0326 moon0326 reopened this Feb 29, 2024
@moon0326 moon0326 closed this Feb 29, 2024
@moon0326 moon0326 reopened this Feb 29, 2024
Copy link
Member

@chihsuan chihsuan left a comment

Choose a reason for hiding this comment

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

Tested well. 👍 Just left a minor comment about the code.

Pre-approving!

@@ -64,6 +64,8 @@ public static function compare( $left_operand, $right_operand, $operation ) {
return strpos( $left_operand, $right_operand ) === false;
}
break;
case 'range':
return $left_operand >= $right_operand[0] && $left_operand <= $right_operand[1];
Copy link
Member

Choose a reason for hiding this comment

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

Should we check if $right_operand is an array and has at least 2 elements like what we have in other cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chihsuan Good suggestion! I'll make the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in d48f340

Copy link
Contributor

@psealock psealock left a comment

Choose a reason for hiding this comment

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

Looks great! Just one minor thing

@@ -183,6 +188,22 @@ onboarding profile:
}
```

#### range

`range` operator can check if a number falls within a certain range
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be a good place to note its inclusive

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@psealock Good suggestion! I'll make the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in f9b3cf2

@moon0326 moon0326 merged commit da64238 into trunk Feb 29, 2024
33 checks passed
@moon0326 moon0326 deleted the add/44787-add-range-rule branch February 29, 2024 21:02
@github-actions github-actions bot added this to the 8.8.0 milestone Feb 29, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Feb 29, 2024
@alvarothomas alvarothomas added status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Mar 1, 2024
Konamiman pushed a commit that referenced this pull request Mar 13, 2024
* Add range rule in Remote Inbox Notification

* Add changefile(s) from automation for the following project(s): woocommerce

* Add range

* Add changefile(s) from automation for the following project(s): packages/php/remote-specs-validation, woocommerce

* Update README.md

* Fix lint errors

* Make sure right-hand is an array with two elemetns -- range

* Update README

* Lint fixes

---------

Co-authored-by: github-actions <github-actions@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remote Spec Rules: Add range operator
4 participants