def pct_complete
case status
when 'completed' then 100
when 'queued' then 0
else
t = (total == 0 || total.nil?) ? 1 : total
(((num || 0).to_f / t.to_f) * 100).to_i
end
end
If the user accidentally sets total to a string by doing something like at(1, "This is my status"), this method will explode by trying to call NaN.to_i, which will cause the web app's Statuses tab to fail.
I'm happy to patch if you tell me how you'd like it done:
If the user accidentally sets
total
to a string by doing something likeat(1, "This is my status")
, this method will explode by trying to callNaN.to_i
, which will cause the web app's Statuses tab to fail.I'm happy to patch if you tell me how you'd like it done:
Jon