zold-io / zold

An Experimental Non-Blockchain Cryptocurrency for Fast Micro Payments
https://www.zold.io
MIT License
194 stars 53 forks source link

It's not clear how method paid works in tax class #685

Open strogiyotec opened 5 years ago

strogiyotec commented 5 years ago

@yegor256 Can you please add some explanation comments to method paid in class Tax because now it's difficult to figure out how this method return a value

def paid
      txns = @wallet.txns
      scored = txns.map do |t|
        pfx, body = t.details.split(' ', 2)
        next if pfx != PREFIX || body.nil?
        score = Score.parse(body)
        next if !score.valid? || score.value != EXACT_SCORE
        if score.strength < @strength && !@ignore_score_weakness
          next unless MILESTONES.find { |d, s| t.date < d && score.strength >= s }
        end
        next if t.amount > MAX_PAYMENT
        t
      end.compact.uniq(&:details)
      scored.empty? ? Amount::ZERO : scored.map(&:amount).inject(&:+) * -1
    end
0crat commented 5 years ago

@yegor256/z please, pay attention to this issue

0crat commented 5 years ago

@strogiyotec/z this project will fix the problem faster if you donate a few dollars to it; just click here and pay via Stripe, it's very fast, convenient and appreciated; thanks a lot!