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

fix: allow run_seconds to use int or str as keys #288

Merged

Conversation

EdLeckert
Copy link
Collaborator

This resolves Issue #284, which pointed out that one of the formats for creating template switches used in the examples no longer works.

Consider this snippet:

  run_seconds:
    0: 60
    1: 60
    2: 60
    3: 60
    4: 60
    5: 60

If this is called as part of opensprinkler.run from Developer tools > Services, the keys are converted to strings, which is what the code expects. However, if it is part of a template switch, they arrive as integers, which dict.get() interprets as a lookup failure and returns None. Ultimately, the run durations are set to 0.

This PR attempts to find both int and str keys. If you know of a better way to cover both cases than to use the default parameter of dict.get(), please speak up.

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@EdLeckert
Copy link
Collaborator Author

@vinteo: I see you have approved this PR. Do you want me to merge it?

@vinteo vinteo merged commit 0150cf1 into vinteo:master May 31, 2024
6 checks passed
@EdLeckert EdLeckert deleted the fix-support-run_seconds-index-as-int-or-str branch June 3, 2024 16:06
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

Successfully merging this pull request may close these issues.

2 participants