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

Split Comparison Helper #93

Merged
merged 1 commit into from Feb 2, 2024
Merged

Split Comparison Helper #93

merged 1 commit into from Feb 2, 2024

Conversation

lloydsal
Copy link
Contributor

@lloydsal lloydsal commented Feb 1, 2024

Context

ComparisonHelper is mainly running different field comparisons under methods in the same class. This prevents us from adding flexibility to individual field comparison logic.

This is step 1 of the logic to make the comparison classes configurable by country.

In step 2 we will attempt to simplify the comparison logic to remove the need for external classes to interact with Token::Sequence::Comparison

Approach

This is a simple refactor and does not bring any change to the logic.

Testing

Checklist

  • I have added a CHANGELOG entry for this change (or determined that it isn't needed)
  • Added Sorbet signatures to new methods I've introduced
  • Commits squashed

@lloydsal lloydsal requested review from kwiersema and a team February 1, 2024 20:14
@lloydsal lloydsal marked this pull request as ready for review February 1, 2024 20:15
@lloydsal lloydsal changed the title Remove comparison helper Split Comparison Helper Feb 1, 2024
Copy link
Contributor

@kwiersema kwiersema left a comment

Choose a reason for hiding this comment

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

LGTM! 🚢

sig { params(address: AbstractAddress, candidate: Candidate, datastore: DatastoreBase).void }
def initialize(address:, candidate:, datastore:)
@comparison_helper = ComparisonHelper.new(address:, candidate:, datastore:)
@street_comparison = StreetComparison.new(address: address, candidate: candidate, datastore: datastore)
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

# typed: true
# frozen_string_literal: true

module AtlasEngine
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

end

sig { params(candidate: Candidate).returns(T::Array[AddressNumberRange]) }
def building_ranges_from_candidate(candidate)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this could be moved into the BuildingComparison class, since that is the only subclass which requires it.

@lloydsal lloydsal merged commit f7fc929 into main Feb 2, 2024
6 checks passed
@plentz plentz deleted the remove-comparison-helper branch March 10, 2024 23:51
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.

None yet

2 participants