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

Prepare for historical data #49

Merged
merged 3 commits into from
May 24, 2021
Merged

Prepare for historical data #49

merged 3 commits into from
May 24, 2021

Conversation

AetherUnbound
Copy link
Collaborator

This PR adds two small changes to prepare for OrcaCollective/spd-lookup#23:

  • Cache salary lookups to improve query performance for multiple rosters
  • Cast all values to string before evaluating (this was failing on boolean values)

Copy link
Collaborator

@mpuckett159 mpuckett159 left a comment

Choose a reason for hiding this comment

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

This looks really great. Glad we finally got this out there.

@@ -1,10 +1,10 @@
{% for field in metadata.fields %}
{% set value = record.get(field.FieldName) %}
{% set value = record.get(field.FieldName) | string %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, smart.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea I was having trouble with the if not boolean so I just opted for this lol

def _augment_with_salary(record: Record) -> str:
last = record["last_name"]
first = record["first_name"]
@lru_cache(maxsize=1000)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Glad we have this, it's slow as hell otherwise.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Lol and it's a one line change too! After moving it out into something that's cached easily

@AetherUnbound AetherUnbound merged commit a302836 into main May 24, 2021
@AetherUnbound AetherUnbound deleted the bugfix/historical-data branch May 24, 2021 00:03
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