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 round to half template method #28948

Merged
merged 2 commits into from
Nov 22, 2019

Conversation

tofuSCHNITZEL
Copy link
Contributor

Description:

extended the round function to accept "half" as a method which will round a number to the nearest .5 value.

2.1 | round(1,"half") => 2.0
2.2 | round(1,"half") => 2.0
2.3 | round(1,"half") => 2.5
2.7 | round(1,"half") => 2.5
2.8 | round(1,"half") => 3.0

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#11257

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the [development checklist][dev-checklist]

If user exposed functionality or configuration variables are added/changed:

Signed-off-by: Tobias Perschon <tobias@perschon.at>
@tofuSCHNITZEL tofuSCHNITZEL requested a review from a team as a code owner November 22, 2019 10:38
@probot-home-assistant probot-home-assistant bot added core small-pr PRs with less than 30 lines. labels Nov 22, 2019
@MartinHjelmare MartinHjelmare changed the title added round to half method Add round to half template method Nov 22, 2019
@balloob
Copy link
Member

balloob commented Nov 22, 2019

Can you add a test

Signed-off-by: Tobias Perschon <tobias@perschon.at>
@tofuSCHNITZEL
Copy link
Contributor Author

Can you add a test

sure I've added one test. should I add more cases for different values?

Copy link
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

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

Thanks !

@balloob balloob merged commit d92f486 into home-assistant:dev Nov 22, 2019
@tofuSCHNITZEL tofuSCHNITZEL deleted the round-to-half branch November 22, 2019 19:02
@lock lock bot locked and limited conversation to collaborators Nov 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed core small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants