-
-
Notifications
You must be signed in to change notification settings - Fork 758
fix: timediff typo #5462
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
fix: timediff typo #5462
Conversation
@blackstrip Thanks for the contribution! Could you please add the Changelog for this PR and, ideally some Unit test to cover the case. Perhaps more details about how you caught this issue/error would help too for someone to review it. |
Hi @armab , Thanks for the reply! |
@blackstrip Thanks for contribution, the latest merge seems to have removed your CHANGELOG changes, could you update to master and try again with the changelog? |
@amanda11 Thanks for review, updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blackstrip One small comment on changelog, and I wonder did you look to see if it was possible to write a UT for the fix as per @armab's suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. please check again. thx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! 👍
@blackstrip Looks like the linting is failing https://github.com/StackStorm/st2/runs/4715712255?check_suite_focus=true#step:11:122 Additionally, new unit tests might need a bit more work per CI failures: https://github.com/StackStorm/st2/runs/4715712802 |
Hi @armab , thx for review. the case is udpated, but maybe git-action failed? please can you re-check? |
That worked. |
Problem:
When i use the webui to make some timediff critera comparison in rules, it always return the
TypeError: '>' not supported between instances of 'float' and 'str'
Check:
I tried so many value in critera form, it's just not work.
Then i found in
operators.py
, the_timediff
is returned(utc_now - diff_target_utc).total_seconds()
as a float number, thetimedelta.total_seconds()
is always return float type, but the critera-comparison is str or intFix:
Just convert the critera value to float, it will be fine.