* adjust for upgrade and holiday.
This commit is contained in:
+19
-24
@@ -205,21 +205,19 @@ class holidayModel extends model
|
|||||||
$workingDays = $this->getWorkingDays($begin, $end);
|
$workingDays = $this->getWorkingDays($begin, $end);
|
||||||
$weekend = isset($this->config->project->weekend) ? $this->config->project->weekend : 2;
|
$weekend = isset($this->config->project->weekend) ? $this->config->project->weekend : 2;
|
||||||
|
|
||||||
|
$holidaysFlip = array_flip($holidays);
|
||||||
|
$workingDaysFlip = array_flip($workingDays);
|
||||||
|
|
||||||
/* When the start date and end date are the same. */
|
/* When the start date and end date are the same. */
|
||||||
|
$beginTimestamp = strtotime($begin);
|
||||||
if($begin == $end)
|
if($begin == $end)
|
||||||
{
|
{
|
||||||
if(in_array($begin, $workingDays)) return $actualDays[] = $begin;
|
if(isset($workingDaysFlip[$begin])) return $actualDays[] = $begin;
|
||||||
if(in_array($begin, $holidays)) return $actualDays;
|
if(isset($holidaysFlip[$begin])) return $actualDays;
|
||||||
|
|
||||||
$w = date('w', strtotime($begin));
|
$w = date('w', $beginTimestamp);
|
||||||
if($weekend == 2)
|
if($weekend == 2 and ($w == 0 or $w == 6)) return $actualDays;
|
||||||
{
|
if($weekend != 2 and $w == 0) return $actualDays;
|
||||||
if($w == 0 or $w == 6) return $actualDays;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if($w == 0) return $actualDays;
|
|
||||||
}
|
|
||||||
|
|
||||||
$actualDays[] = $begin;
|
$actualDays[] = $begin;
|
||||||
return $actualDays;
|
return $actualDays;
|
||||||
@@ -227,24 +225,21 @@ class holidayModel extends model
|
|||||||
|
|
||||||
for($i = 0; $currentDay < $end; $i ++)
|
for($i = 0; $currentDay < $end; $i ++)
|
||||||
{
|
{
|
||||||
$currentDay = date('Y-m-d', strtotime("$begin + $i days"));
|
$currentTimestamp = $beginTimestamp + ($i * 24 * 3600);
|
||||||
$w = date('w', strtotime($currentDay));
|
$currentDay = date('Y-m-d', $currentTimestamp);
|
||||||
|
|
||||||
if(in_array($currentDay, $workingDays))
|
if(isset($workingDaysFlip[$currentDay]))
|
||||||
{
|
{
|
||||||
$actualDays[] = $currentDay;
|
$actualDays[] = $currentDay;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(in_array($currentDay, $holidays)) continue;
|
if(isset($holidaysFlip[$currentDay])) continue;
|
||||||
if($weekend == 2)
|
|
||||||
{
|
$w = date('w', $currentTimestamp);
|
||||||
if($w == 0 or $w == 6) continue;
|
if($weekend == 2 and ($w == 0 or $w == 6)) continue;
|
||||||
}
|
if($weekend != 2 and $w == 0) continue;
|
||||||
else
|
|
||||||
{
|
|
||||||
if($w == 0) continue;
|
|
||||||
}
|
|
||||||
$actualDays[] = $currentDay;
|
$actualDays[] = $currentDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,7 +261,7 @@ class holidayModel extends model
|
|||||||
$days = ($endTime - $beginTime) / 86400;
|
$days = ($endTime - $beginTime) / 86400;
|
||||||
|
|
||||||
$dateList = array();
|
$dateList = array();
|
||||||
for($i = 0; $i <= $days; $i ++) $dateList[] = date('Y-m-d', strtotime("+$i days", $beginTime));
|
for($i = 0; $i <= $days; $i ++) $dateList[] = date('Y-m-d', $beginTime + ($i *24 *3600));
|
||||||
|
|
||||||
return $dateList;
|
return $dateList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -432,6 +432,8 @@ class projectModel extends model
|
|||||||
$AC = 0;
|
$AC = 0;
|
||||||
while($task = $stmt->fetch())
|
while($task = $stmt->fetch())
|
||||||
{
|
{
|
||||||
|
if(empty($task->estimate)) continue;
|
||||||
|
|
||||||
$PV += $task->estimate;
|
$PV += $task->estimate;
|
||||||
$AC += $task->consumed;
|
$AC += $task->consumed;
|
||||||
if($task->status == 'done' or $task->closedReason == 'done')
|
if($task->status == 'done' or $task->closedReason == 'done')
|
||||||
@@ -440,7 +442,8 @@ class projectModel extends model
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$task->progress = round($task->consumed / ($task->consumed + $task->left), 2) * 100;
|
$task->progress = 0;
|
||||||
|
if(($task->consumed + $task->left) > 0) $task->progress = round($task->consumed / ($task->consumed + $task->left), 2) * 100;
|
||||||
$EV += round($task->estimate * $task->progress / 100, 2);
|
$EV += round($task->estimate * $task->progress / 100, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ $lang->task->exportAction = "Export Task";
|
|||||||
$lang->task->reportChart = "Bericht Chart";
|
$lang->task->reportChart = "Bericht Chart";
|
||||||
$lang->task->fromBug = 'Von Bug';
|
$lang->task->fromBug = 'Von Bug';
|
||||||
$lang->task->case = 'Fall';
|
$lang->task->case = 'Fall';
|
||||||
|
$lang->task->process = 'Process Task';
|
||||||
$lang->task->confirmStoryChange = "Storyäanderung bestätigen";
|
$lang->task->confirmStoryChange = "Storyäanderung bestätigen";
|
||||||
$lang->task->storyChange = "Story Changed";
|
$lang->task->storyChange = "Story Changed";
|
||||||
$lang->task->progress = 'Fortschritt';
|
$lang->task->progress = 'Fortschritt';
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ $lang->task->exportAction = "Export Task";
|
|||||||
$lang->task->reportChart = "Report Chart";
|
$lang->task->reportChart = "Report Chart";
|
||||||
$lang->task->fromBug = 'From Bug';
|
$lang->task->fromBug = 'From Bug';
|
||||||
$lang->task->case = 'Linked Case';
|
$lang->task->case = 'Linked Case';
|
||||||
|
$lang->task->process = 'Process Task';
|
||||||
$lang->task->confirmStoryChange = "Confirm Change";
|
$lang->task->confirmStoryChange = "Confirm Change";
|
||||||
$lang->task->storyChange = "Story Changed";
|
$lang->task->storyChange = "Story Changed";
|
||||||
$lang->task->progress = 'Progress';
|
$lang->task->progress = 'Progress';
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ $lang->task->exportAction = "Exporter Tâche";
|
|||||||
$lang->task->reportChart = "Rapport Graphique";
|
$lang->task->reportChart = "Rapport Graphique";
|
||||||
$lang->task->fromBug = 'à partir Bug';
|
$lang->task->fromBug = 'à partir Bug';
|
||||||
$lang->task->case = 'Associée CasTest';
|
$lang->task->case = 'Associée CasTest';
|
||||||
|
$lang->task->process = 'Process Task';
|
||||||
$lang->task->confirmStoryChange = "Confirmer Changement";
|
$lang->task->confirmStoryChange = "Confirmer Changement";
|
||||||
$lang->task->storyChange = "Story Changée";
|
$lang->task->storyChange = "Story Changée";
|
||||||
$lang->task->progress = 'Progression';
|
$lang->task->progress = 'Progression';
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ $lang->task->exportAction = "导出任务";
|
|||||||
$lang->task->reportChart = "报表统计";
|
$lang->task->reportChart = "报表统计";
|
||||||
$lang->task->fromBug = '来源Bug';
|
$lang->task->fromBug = '来源Bug';
|
||||||
$lang->task->case = '相关用例';
|
$lang->task->case = '相关用例';
|
||||||
|
$lang->task->process = '处理任务';
|
||||||
$lang->task->confirmStoryChange = "确认{$lang->SRCommon}变动";
|
$lang->task->confirmStoryChange = "确认{$lang->SRCommon}变动";
|
||||||
$lang->task->storyChange = "{$lang->SRCommon}变更";
|
$lang->task->storyChange = "{$lang->SRCommon}变更";
|
||||||
$lang->task->progress = '进度';
|
$lang->task->progress = '进度';
|
||||||
|
|||||||
@@ -7332,6 +7332,7 @@ class upgradeModel extends model
|
|||||||
{
|
{
|
||||||
$estimates = $this->dao->select('*')->from(TABLE_TASKESTIMATE)->orderBy('id')->fetchAll();
|
$estimates = $this->dao->select('*')->from(TABLE_TASKESTIMATE)->orderBy('id')->fetchAll();
|
||||||
|
|
||||||
|
$this->app->loadLang('task');
|
||||||
$this->loadModel('action');
|
$this->loadModel('action');
|
||||||
foreach($estimates as $estimate)
|
foreach($estimates as $estimate)
|
||||||
{
|
{
|
||||||
@@ -7343,7 +7344,7 @@ class upgradeModel extends model
|
|||||||
$effort->product = $relation['product'];
|
$effort->product = $relation['product'];
|
||||||
$effort->project = (int)$relation['project'];
|
$effort->project = (int)$relation['project'];
|
||||||
$effort->account = $estimate->account;
|
$effort->account = $estimate->account;
|
||||||
$effort->work = empty($estimate->work) ? $this->lang->effort->handleTask : $estimate->work;
|
$effort->work = empty($estimate->work) ? $this->lang->task->process : $estimate->work;
|
||||||
$effort->date = $estimate->date;
|
$effort->date = $estimate->date;
|
||||||
$effort->left = $estimate->left;
|
$effort->left = $estimate->left;
|
||||||
$effort->consumed = $estimate->consumed;
|
$effort->consumed = $estimate->consumed;
|
||||||
@@ -7380,6 +7381,7 @@ class upgradeModel extends model
|
|||||||
$chats = $this->dao->select('gid, id')->from(TABLE_IM_CHAT)
|
$chats = $this->dao->select('gid, id')->from(TABLE_IM_CHAT)
|
||||||
->where('createdDate')->eq('0000-00-00 00:00:00')
|
->where('createdDate')->eq('0000-00-00 00:00:00')
|
||||||
->fetchPairs('gid');
|
->fetchPairs('gid');
|
||||||
|
if(empty($chats)) return true;
|
||||||
|
|
||||||
$createdDateData = array();
|
$createdDateData = array();
|
||||||
|
|
||||||
@@ -7423,6 +7425,7 @@ class upgradeModel extends model
|
|||||||
}, $chatDates);
|
}, $chatDates);
|
||||||
|
|
||||||
$knownMinDates = array_merge($knownMinDates, $chatDates);
|
$knownMinDates = array_merge($knownMinDates, $chatDates);
|
||||||
|
if(empty($knownMinDates)) return true;
|
||||||
|
|
||||||
$queryData = array();
|
$queryData = array();
|
||||||
foreach($knownMinDates as $gid => $date) $queryData[] = "WHEN {$chats[$gid]} THEN '{$date}'";
|
foreach($knownMinDates as $gid => $date) $queryData[] = "WHEN {$chats[$gid]} THEN '{$date}'";
|
||||||
@@ -7450,6 +7453,7 @@ class upgradeModel extends model
|
|||||||
->orWhere('endIndex')->eq(0)
|
->orWhere('endIndex')->eq(0)
|
||||||
->orderBy('id_asc')
|
->orderBy('id_asc')
|
||||||
->fetchAll();
|
->fetchAll();
|
||||||
|
if(empty($chatTableData)) return true;
|
||||||
|
|
||||||
/* Sort ranges by table. */
|
/* Sort ranges by table. */
|
||||||
$tableRanges = array();
|
$tableRanges = array();
|
||||||
|
|||||||
@@ -433,7 +433,8 @@ class weeklyModel extends model
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$task->progress = round($task->consumed / ($task->consumed + $task->left), 2) * 100;
|
$task->progress = 0;
|
||||||
|
if(($task->consumed + $task->left) > 0) $task->progress = round($task->consumed / ($task->consumed + $task->left), 2) * 100;
|
||||||
$EV += round($thisPV * $task->progress / 100, 2);
|
$EV += round($thisPV * $task->progress / 100, 2);
|
||||||
}
|
}
|
||||||
$PV += $thisPV;
|
$PV += $thisPV;
|
||||||
|
|||||||
Reference in New Issue
Block a user