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

Modulo panicking #454

Open
Omnia89 opened this issue Jul 22, 2024 · 0 comments
Open

Modulo panicking #454

Omnia89 opened this issue Jul 22, 2024 · 0 comments

Comments

@Omnia89
Copy link

Omnia89 commented Jul 22, 2024

Describe the bug
I've tried to use the modulo operator, either like an operator and the function, but it keeps giving me error on execution.
I'm using the JSON format of the rule.

The object given is a JSON, and I've tried to give both {"Lengh": 10} and {"Lengh": 10.0}

The rule is:

--- Function version 
[
    {
        "name": "Test",
        "salience": 10,
        "then": [
            {
                "set": [
                    "Item.Price",
                    {
                        "call": [
                            "ItemFunc.PriceMultiply",
                            {
                                "obj": "Item.Price"
                            },
                            {
                                "const": 0.9
                            }
                        ]
                    }
                ]
            },
            {
                "call": [
                    "Retract",
                    {
                        "const": "Test"
                    }
                ]
            }
        ],
        "when": {
            "eq": [
                {
                    "call": [
                        "Mod",
                        {
                            "obj": "Item.Length"
                        },
                        {
                            "const": 10
                        }
                    ]
                },
                {
                    "const": 0
                }
            ]
        }
    }
]
--- Operation version
...
        "eq": [
                     {
                         "mod": [
                             {
                                 "obj": "Item.Length"
                             },
                             {
                                 "const": 10
                             }
                         ]
                     },
                     {
                         "const": 0
                     }
          ]
...

In the first one, the error says that I cannot use int64 for float64 args.
In the second one that I cannot use float64 for int64 args.

Expected behavior
To do the modulo operation

Additional context
github.com/hyperjumptech/grule-rule-engine v1.10.5
go 1.16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant