JSFiddle - React, Tailwind, and code Playground

by Daedalus

HTML

<input id="ct" placeholder="current total" />
<br />
<input id="ot" placeholder="original total" />
<br />
<input id="ic" placeholder="increase amount" />
<br />
<button id="calculate">Calculate</button>
<br />
<span id='blah'></span>

JavaScript

function test_increase(ct, ot, ic) {
    var current_total = ct,
        original_total = ot,
        inc_amt = ic,
        until = 2000,
        mod = 2.5,
        bonus_i = 0,
        remainder = 0;

    // Where the 'magic' is supposed to happen, but doesn't
    if ((current_total + (inc_amt * mod)) < until) {
        remainder = ((until - current_total) % mod);
        current_total += ((inc_amt - remainder) * mod);
        current_total += remainder;
    }

    document.getElementById('blah').innerHTML = current_total;
}

$(function () {
    $("#calculate").click(function () {
        var ct = parseInt($("#ct").val(), 10),
            ot = parseInt($("#ot").val(), 10),
            ic = parseInt($("#ic").val(), 10);
            test_increase(ct, ot, ic);
    });
});