brvphoenix / luci-app-wrtbwmon

Bandwidth monitor for OpenWRT
260 stars 55 forks source link

Fix percentage calculation #70

Closed Quphoria closed 1 year ago

Quphoria commented 1 year ago
function progressbar(query, v, m, useBits, useMultiple) {
    var pg = $(query),
        vn = v || 0,
        mn = formatBandWidth(m, useBits) || 100,
        fv = formatSpeed(v, useBits, useMultiple),
        pc = '%.2f'.format((100 / mn) * vn),
        ...

m is in Mbits/s, v is in bytes/s m was getting converted to bytes/s when useBits was false, however, it wasn't when useBits was true, meaning all percentages were 1/8th what they should be