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

V1.3 and up #36

Merged
merged 17 commits into from
Oct 12, 2016
Merged

V1.3 and up #36

merged 17 commits into from
Oct 12, 2016

Conversation

acreilly
Copy link
Contributor

@acreilly acreilly commented Oct 11, 2016

Gem works with solidus versions v1.3 & up

Need to delete branches v1.3, v1.4, & v2.0 after this is merged so there is no confusion.

This was referenced Oct 11, 2016
@@ -1 +1 @@
1.3.0
2.0.0.rc1
Copy link

Choose a reason for hiding this comment

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

This should be 2.0.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should probably just be deleted because it isn't used anywhere anymore

@@ -66,7 +66,11 @@ def self.customer_can_validate
end

def is_true?
ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(value)
Copy link

Choose a reason for hiding this comment

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

This could probably be condensed to just

def is_true?
  [true, 1, '1', 't', 'T', 'true', 'TRUE', 'on',  'ON'].include?(value)
end

Also curious as to where the variable value is defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

value is a column in the AvalaraPreference table

@@ -22,7 +22,7 @@ def get_file_avalara_order
def erase_data
File.open("log/#{params['log_name']}.log", 'w') {}

render nothing: true
render body: nil
Copy link

Choose a reason for hiding this comment

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

head: ok I think was the correct swap

Copy link

@skukx skukx left a comment

Choose a reason for hiding this comment

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

🐹 Looks good to me

@@ -63,14 +63,12 @@ def cache_key(order)

Copy link

Choose a reason for hiding this comment

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

Your cache key is very expensive, and it might be just easier to do without it. You are loading in Ruby all line items, all adjustments, the order, the shipments ... that's really a lot. Most of those propagate any changes to the order's updated at, so just use that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we use updated_at it hits the API too many times. I just tested, going from delivery to payment in checkout, the difference between what we have now and changing it to check updated at and what we have now only hits the API once, and when I used updated_at, it hit the API four times.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Manuel had worked on the cache key at a point in time before, trying to limit the api calls and complexity and this is what we have resulted with.

Copy link

Choose a reason for hiding this comment

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

It's then better to fetch the max(updated_at) out of the database directly for each of those collections - line items, shipments, etc ..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can this be created as an issue an tackled on another PR? This PR has to do with allowing the gem to work with v1.3 & up of solidus.

Copy link

Choose a reason for hiding this comment

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

that's the right way indeed 👍

@acreilly acreilly merged commit 6dd49e6 into master Oct 12, 2016
@acreilly acreilly deleted the v1.3-and-up branch October 12, 2016 15:21
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