Skip to content

Instantly share code, notes, and snippets.

Ulimited length elb "name" here!
### Keybase proof
I hereby claim:
* I am byped on github.
* I am gbabbitt (https://keybase.io/gbabbitt) on keybase.
* I have a public key whose fingerprint is A1C9 0A8E 22F5 4239 3542 4301 FC17 1A9F D21E 012A
To claim this, I am signing this object:
def apply_adjustments
adjustments = self.class.adjustments_to_apply[self.status.name.methodize.to_sym] || []
return if adjustments.empty?
total_adjustment = adjustments.inject(0.0){ |total,adjust| total + adjust.apply_to(self).to_f }
return if total_adjustment == 0.0
case self.status.name.methodize.to_sym
when :shipping_ready, :pending
self.estimated_total = ('%.2f' % (self.estimated_total + total_adjustment)).to_f if self.estimated_value
#this method gets called on the before_save of transaction_item.
def apply_adjustments
applicable_adjustments = self.class.adjustments_to_apply[self.status.name.methodize.to_sym] || []
unless applicable_adjustments.empty?
pairing = if [:shipping_ready, :pending].include?(self.status.name.methodize.to_sym) && self.estimated_value
[:estimated_value, :estimated_total=]
elsif [:awaiting_confirmation, :accepted].include?(self.status.name.methodize.to_sym) &&
self.inspected_value
[:inspected_value, :payout_total=]
end