summaryrefslogtreecommitdiff
path: root/http/pkle2018.php
diff options
context:
space:
mode:
Diffstat (limited to 'http/pkle2018.php')
-rw-r--r--http/pkle2018.php29
1 files changed, 14 insertions, 15 deletions
diff --git a/http/pkle2018.php b/http/pkle2018.php
index a851ead..5e7e9e1 100644
--- a/http/pkle2018.php
+++ b/http/pkle2018.php
@@ -342,9 +342,9 @@ function submitit(){
if( t.value!=null && t.value!='' && isFinite(t.value) ){
t = document.getElementById("swk");
if( t.value!=null && t.value!='' && isFinite(t.value) ){
-
+
document.getElementById("pkl").submit();
-
+
} else {
alert('Brak sumy WK!');
t.select();
@@ -369,7 +369,7 @@ function submitit(){
-->
</script>
</head>
-<body style="background-color: #F0F0F0; background-image: none">
+<body style="background-color: #F0F0F0; background-image: none">
<form id="pkl" method="post" action="pkle2018.php">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
@@ -440,7 +440,7 @@ function submitit(){
<td>&nbsp;</td>
<td colspan="2"><table cellspacing="0" cellpadding="0"><tr><td align="right" style="width:50px"><input type="text" id="pru1" name="pru1" style="width:18px" value=<?php echo '"'.$progu1.'"'; ?>>%</td><td align="right" style="width:25px"><input type="text" id="pru2" name="pru2" style="width:18px" value=<?php echo '"'.$progu2.'"'; ?>>%</td><td align="right" style="width:55px"><input type="text" id="pru3" name="pru3" style="width:18px" value=<?php echo '"'.$progu3.'"'; ?>>%</td></tr></table></td>
</tr>
-
+
<tr><td colspan="5">&nbsp;</td></tr>
<tr>
<td valign=top rowspan="2">TYP ZAWODÓW<br />
@@ -449,7 +449,7 @@ function submitit(){
<input type="radio" name="typ" id="tp3" value="4" onclick="typtur(4)"<?php if( $typ==4 ){ echo ' checked="checked"';}?>><label for="tp3">&nbsp;Teamy</label>
<br><br>LICZBA ROZDAŃ<br>
<input type="radio" name="rozdan" id="rozdan0" value="0"<?php if( !$rozdan ){ echo ' checked="checked"';}?>><label for="rozdan0">&nbsp;do 39</label><br />
- <input type="radio" name="rozdan" id="rozdan1" value="1"<?php if( $rozdan ){ echo ' checked="checked"';}?>><label for="rozdan1">&nbsp;od 40</label>
+ <input type="radio" name="rozdan" id="rozdan1" value="1"<?php if( $rozdan ){ echo ' checked="checked"';}?>><label for="rozdan1">&nbsp;od 40</label>
</td>
<td valign=top rowspan="2">RANGA ZAWODÓW<br />
<input type="radio" name="rng" id="rg1" value="1"<?php if( $_POST['rng']==1 ){echo ' checked="checked"';}?>><label for="rg1">&nbsp;OTP<sup>&lowast;&lowast;&lowast;&lowast;</sup></label><br />
@@ -492,15 +492,20 @@ if( $tab>0 ){
</tr>
<tr><td colspan="2" align="center">
<?php
+function safe_ceil($value, $precision = 1e-6) {
+ $ceilValue = ceil($value);
+ return (abs($value - $ceilValue) < (1-$precision)) ? $ceilValue : round($value);
+}
if( $tab>0 ){
unset( $tabpkl );
$lasti = 0;
echo '<table><tr><td class="t">Miejsce</td><td class="t">&nbsp;&nbsp;&nbsp;PKL&nbsp;&nbsp;&nbsp;</td>';
echo '</tr>';
// #zmiany2018 - poprzednie brzmienie: $max = ceil(($swk/$izw)*$rng + $izw*$zaw);
- $max = ($swk/$izw)*$rng + $izw*$zaw;
+ // #bugfix2019 - poprzednie brzmienie: $max = ($swk/$izw)*$rng + $izw*$zaw;
+ $max = max(0.15,($swk/$izw))*$rng + $izw*$zaw;
if($typ == 4) $max = $max*1.25; // mnożnik 1.25 dla teamów UCHWAŁA Zarządu NR 52/2018/2016–2020
- $max = ceil($max);
+ $max = safe_ceil($max);
// #zmiany2018 - koniec zmienionego fragmentu
if( $max<$minpkl ) $max = $minpkl;
$prem = 0;
@@ -518,7 +523,7 @@ if( $tab>0 ){
} else {
$d = 0;
}
- $maxold = ceil($prcold*$izw + 0.05*$swk);
+ $maxold = safe_ceil($prcold*$izw + 0.05*$swk);
$progu1 = $progu1*$iuc*0.01+1;
$progu2 = $progu2*$iuc*0.01+1;
$progu3 = $progu3*$iuc*0.01+1; // 0 pkl za ostatnie punktowane+1
@@ -527,7 +532,6 @@ if( $tab>0 ){
$sumn = 0 ;
$sumo = 0;
$i = 0;
- $dok = 1 - 1e-6; // unikamy błędu ceil(2)=3;
do{
$i++;
if( $i<=$progu1 ){
@@ -543,12 +547,7 @@ if( $tab>0 ){
if( ($p>0) ){
echo '<tr><td class="t">'.$i.'</td>';
if( $p>0 ){
- $pkl_temp = ceil($p);
- if (($pkl_temp - $p) < $dok){
- $p = $pkl_temp;
- } else {
- $p = round($p);
- }
+ $p = safe_ceil($p);
$tabkl[$i] = $p;
$lasti = $i;
echo '<td class="t">'.$p.'</td>';