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

Auditor checks if events exist before setting to 0 #1619

Merged
merged 2 commits into from
Nov 24, 2021

Conversation

atummons
Copy link
Contributor

The _load_defaults was setting all events that were configured to 0 when
this was called (which happens on every _initiatlize. This changes it
to be the same logic as switches and players. It checks if the event is
already in the list. If it is not, it creates it and sets it to 0. If
it is in the list, it is ignored. This also works for the reset because
it blanks the entire list out first, then recreates. So when it does
this, all values would be missing, and thus are created with a value of
0.

The _load_defaults was setting all events that were configured to 0 when
this was called (which happens on every _initiatlize.  This changes it
to be the same logic as switches and players.  It checks if the event is
already in the list.  If it is not, it creates it and sets it to 0.  If
it is in the list, it is ignored.  This also works for the reset because
it blanks the entire list out first, then recreates.  So when it does
this, all values would be missing, and thus are created with a value of
0.
@atummons
Copy link
Contributor Author

@jabdoa2 The one CI error isn't related to what I touched:

build/lib/mpf/core/file_interface.py
Line: 4
pylint: unused-import / Unused Union imported from typing

I can go remove Union from the import, but want to verify first since I didn't touch that file.

@atummons atummons changed the title Checks if events exist before setting to 0 Auditor checks if events exist before setting to 0 Nov 24, 2021
@jabdoa2
Copy link
Collaborator

jabdoa2 commented Nov 24, 2021

Awesome! Thanks!

Copy link
Collaborator

@avanwinkle avanwinkle left a comment

Choose a reason for hiding this comment

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

Neato!

@jabdoa2
Copy link
Collaborator

jabdoa2 commented Nov 24, 2021

@jabdoa2 The one CI error isn't related to what I touched:

build/lib/mpf/core/file_interface.py Line: 4 pylint: unused-import / Unused Union imported from typing

I can go remove Union from the import, but want to verify first since I didn't touch that file.

Feel free to fix it. Either I broke that by accident or maybe the linter got some update which resulted in new findings.

@sonarcloud
Copy link

sonarcloud bot commented Nov 24, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@atummons
Copy link
Contributor Author

@jabdoa2 The one CI error isn't related to what I touched:
build/lib/mpf/core/file_interface.py Line: 4 pylint: unused-import / Unused Union imported from typing
I can go remove Union from the import, but want to verify first since I didn't touch that file.

Feel free to fix it. Either I broke that by accident or maybe the linter got some update which resulted in new findings.

All good to go now!

@jabdoa2 jabdoa2 merged commit dcd4767 into missionpinball:dev Nov 24, 2021
@atummons atummons deleted the auditor_event branch August 31, 2023 17:10
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.

3 participants