This commit is contained in:
holan20180123
2021-05-19 16:17:06 +08:00
parent e95769b7cc
commit 3dc31bc299
3 changed files with 21 additions and 25 deletions
+7 -5
View File
@@ -20,11 +20,13 @@ function computeAverage()
$('.new-estimate').each(function()
{
var value = $(this).find('input').val();
if(!value) return false;
value = parseFloat(value);
if(isNaN(value)) value = 0;
summary += value;
count += 1;
if(value)
{
value = parseFloat(value);
if(isNaN(value)) value = 0;
summary += value;
count += 1;
}
})
if(count) average = summary / count;
+11 -17
View File
@@ -43,35 +43,29 @@
</tr>
</thead>
<tbody>
<?php if(!empty($estimateInfo->estimate)):?>
<?php foreach($estimateInfo->estimate as $estimate):?>
<tr class='text-center'>
<td><?php echo zget($users, $estimate->account);?></td>
<?php echo html::hidden('account[]', $estimate->account, "class='form-control'");?>
<td><?php echo $estimate->estimate;?></td>
<td class='new-estimate hide'><?php echo html::input('estimate[]', '', "class='form-control'");?></td>
</tr>
<?php endforeach;?>
<tr class='text-center'>
<td><?php echo $lang->execution->average;?></td>
<td><?php echo $estimateInfo->average;?></td>
<td class='new-estimate hide'><p id='showAverage'></p></td>
<?php echo html::hidden('average', '', "class='form-control'");?>
</tr>
<?php else:?>
<?php foreach($team as $user):?>
<tr class='text-center'>
<td><?php echo zget($users, $user->account);?></td>
<?php echo html::hidden('account[]', $user->account, "class='form-control'");?>
<?php if(!empty($estimateInfo->estimate)):?>
<td><?php echo $estimateInfo->estimate->{$user->account}->estimate;?></td>
<td class='new-estimate hide'><?php echo html::input('estimate[]', '', "class='form-control'");?></td>
<?php else:?>
<td class='new-estimate'><?php echo html::input('estimate[]', '', "class='form-control'");?></td>
<?php endif;?>
</tr>
<?php endforeach;?>
<tr class='text-center'>
<td><strong><?php echo $lang->execution->average;?></strong></td>
<?php if(!empty($estimateInfo->estimate)):?>
<td><?php echo $estimateInfo->average;?></td>
<td class='new-estimate hide'><p id='showAverage'></p></td>
<?php echo html::hidden('average', '', "class='form-control'");?>
<?php else:?>
<td><p id='showAverage'></p></td>
<?php echo html::hidden('average', '', "class='form-control'");?>
<?php endif;?>
</tr>
<?php endif;?>
</tbody>
<tfoot>
<tr>
+3 -3
View File
@@ -4042,13 +4042,13 @@ class storyModel extends model
$estimates = array();
foreach($data->account as $key => $account)
{
$estimates[$key]['account'] = $account;
if(!is_numeric($data->estimate[$key]))
$estimates[$account]['account'] = $account;
if(!empty($data->estimate[$key]) and !is_numeric($data->estimate[$key]))
{
dao::$errors[] = $this->lang->story->estimateMustBeNumber;
return false;
}
$estimates[$key]['estimate'] = $data->estimate[$key];
$estimates[$account]['estimate'] = $data->estimate[$key];
}