lib/zold/tax.rb
# The exact score a wallet can/must buy in order to pay taxes.
The exact score a wallet can/must buy in order to pay taxes.
The exact score a wallet can / must buy in order to pay taxes .
def paid
      txns = @wallet.txns
      scored = txns.map do |t|
        next if t.amount.positive?
        pfx, body = t.details.split(' ', 2)
        next if pfx != PREFIX || body.nil?
        score = Score.parse(body)
        next unless score.valid?
        next unless score.value == EXACT_SCORE || @ignore_score_weakness
        if score.strength < @strength && !@ignore_score_weakness
          next unless MILESTONES.find { |d, s| t.date < d && score.strength >= s }
        end
        next if t.amount * -1 > MAX_PAYMENT
        t
      end.compact.uniq(&:details)
      scored.empty? ? Amount::ZERO : scored.map(&:amount).inject(&:+) * -1
    end
def paid txns = @wallet . txns scored = txns . map do | t | next if t . amount . positive? pfx , body = t . details . split ( ' ' , 2 ) next if pfx != PREFIX || body . nil? score = Score . parse ( body ) next unless score . valid? next unless score . value == EXACT_SCORE || @ignore_score_weakness if score . strength < @strength && ! @ignore_score_weakness next unless MILESTONES . find { | d , s | t . date < d && score . strength >= s } end next if t . amount * - 1 > MAX_PAYMENT t end . compact . uniq ( & :details ) scored . empty? ? Amount :: ZERO : scored . map ( & :amount ) . inject ( & :+ ) * - 1 end
The exact score a wallet can/must buy in order to pay taxes.
The exact score a wallet can / must buy in order to pay taxes .