Guard Empty Puck - Balancer Equation Test
by Bryson Murray
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<div>
Total Space: <span id="total_space"></span>
</div>
<div>
Available Space: <span id="avail_space"></span>
</div>
<div>
Adjusted Available Space: <span id="adj_avail_space"></span>
</div>
JavaScript
var total = 15000;
var avail = 10000;
var adj = avail;
var freeSpaceThreshold =.5;
/* if(total < avail*2){
adj = ((total/2)+avail)/2;
} */
if(total < avail/freeSpaceThreshold){
adj = ((total*freeSpaceThreshold)+avail)/2;
}
$(document).ready(function(){
$("#total_space").text(total);
$("#avail_space").text(avail);
$("#adj_avail_space").text(adj);
});