Last active
May 19, 2020 07:52
-
-
Save KorbinianP/1c628ab4a4a687cf7fb5d9a64c4cf435 to your computer and use it in GitHub Desktop.
SCRUM Story Point Calculator, preview at https://htmlpreview.github.io/?https://gist.githubusercontent.com/KorbinianP/1c628ab4a4a687cf7fb5d9a64c4cf435/raw/c38dc63c4f9c49f74053ac5b93f8cb053f23c471/StorypointsCalc_TShirt.htm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>T-Shirt Size to Storypoints Calculator</title> | |
<script type="text/javascript"> | |
function calculate(){ | |
xs = Number(document.calculator.xs.value); | |
s = Number(document.calculator.s.value); | |
m = Number(document.calculator.m.value); | |
l = Number(document.calculator.l.value); | |
xl = Number(document.calculator.xl.value); | |
xxl = Number(document.calculator.xxl.value); | |
sum = xs + s + m + l + xl + xxl | |
points = (xs*0.5) + (s*1) + (m*3) + (l*8) + (xl*20) + (xxl*40) | |
average = points / sum | |
left = Math.floor(average) | |
right = average - left | |
if ((right>0.5) && (right<1)) { | |
right = 1 | |
} else if ((right>0) && (right<=0.5)) { | |
right = 0.5 | |
} | |
document.calculator.storypoints.value = left + right | |
} | |
function minus(num){ | |
switch(num) { | |
case 0: if(document.calculator.xs.value>0) document.calculator.xs.value--; break; | |
case 1: if(document.calculator.s.value>0) document.calculator.s.value--; break; | |
case 2: if(document.calculator.m.value>0) document.calculator.m.value--; break; | |
case 3: if(document.calculator.l.value>0) document.calculator.l.value--; break; | |
case 4: if(document.calculator.xl.value>0) document.calculator.xl.value--; break; | |
case 5: if(document.calculator.xxl.value>0) document.calculator.xxl.value--; break; | |
} | |
calculate(); | |
} | |
function plus(num){ | |
switch(num) { | |
case 0: document.calculator.xs.value++; break; | |
case 1: document.calculator.s.value++; break; | |
case 2: document.calculator.m.value++; break; | |
case 3: document.calculator.l.value++; break; | |
case 4: document.calculator.xl.value++; break; | |
case 5: document.calculator.xxl.value++; break; | |
} | |
calculate(); | |
} | |
</script> | |
<style> | |
.morespace td {padding-top:10px;} | |
body{font-size: 18px; font-family: monospace;} | |
input[type="text"]{font-size:18px; font-family: monospace;} | |
</style> | |
</head> | |
<body> | |
<form name="calculator"> | |
<table border="0"> | |
<tr><td>XS:</td> <td><input type="text" name="xs" onkeyup="javascript:calculate();" size="3"></td> | |
<td><button type="button" id="xsm" onclick="javascript:minus(0);">-</button><button type="button" id="xsp" onclick="javascript:plus(0);">+</button></td></tr> | |
<tr><td>S:</td> <td><input type="text" name="s" onkeyup="javascript:calculate();" size="3"></td> | |
<td><button type="button" id="sm" onclick="javascript:minus(1);">-</button><button type="button" id="sp" onclick="javascript:plus(1);">+</button></td></tr> | |
<tr><td>M:</td> <td><input type="text" name="m" onkeyup="javascript:calculate();" size="3"></td> | |
<td><button type="button" id="mm" onclick="javascript:minus(2);">-</button><button type="button" id="mp" onclick="javascript:plus(2);">+</button></td></tr> | |
<tr><td>L:</td> <td><input type="text" name="l" onkeyup="javascript:calculate();" size="3"></td> | |
<td><button type="button" id="lm" onclick="javascript:minus(3);">-</button><button type="button" id="lp" onclick="javascript:plus(3);">+</button></td></tr> | |
<tr><td>XL:</td> <td><input type="text" name="xl" onkeyup="javascript:calculate();" size="3"></td> | |
<td><button type="button" id="xlm" onclick="javascript:minus(4);">-</button><button type="button" id="xlp" onclick="javascript:plus(4);">+</button></td></tr> | |
<tr><td>XXL:</td> <td><input type="text" name="xxl" onkeyup="javascript:calculate();" size="3"></td> | |
<td><button type="button" id="xxlm" onclick="javascript:minus(5);">-</button><button type="button" id="xxlp" onclick="javascript:plus(5);">+</button></td></tr> | |
<tr class="morespace"> | |
<td>SP:</td> | |
<td><input type="text" name="storypoints" size="5" readonly></td> | |
</tr> | |
<tr class="morespace"> | |
<td><input type="reset" value="Clear"></td> | |
<td><input type="button" value="Calc" onclick="javascript:addition();"></td> | |
</tr> | |
</table> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment