* Code for task#60640

This commit is contained in:
zenggang
2022-07-12 07:15:13 +00:00
parent 58941466a6
commit 6a84cd7469
3 changed files with 38 additions and 1 deletions
+1
View File
@@ -1389,6 +1389,7 @@ class execution extends control
if(date("Y-m-d", strtotime("-3 months", strtotime($end))) > $begin) return $this->sendError($this->lang->execution->charts->cfd->errorDateRange);
$this->execution->computeCFD($executionID);
$this->execution->checkCFDData($executionID, $begin);
return print(js::locate($this->createLink('execution', 'cfd', "executionID=$executionID&type=$type&withWeekend=$withWeekend&begin=" . helper::safe64Encode(urlencode($begin)) . "&end=" . helper::safe64Encode(urlencode($end))), 'parent'));
}
+1 -1
View File
@@ -138,5 +138,5 @@ $(function()
});
$("#end, #begin").datetimepicker('setEndDate', today)
$('.datetimepicker-days table tfoot tr th').html(dateRangeTip).removeClass('today');
$('.datetimepicker-days table tfoot').append('<tr><th colspan="7">' + dateRangeTip + '</th></tr>');
});
+36
View File
@@ -3072,6 +3072,42 @@ class executionModel extends model
}
}
/**
* Check whether there is data on the specified date of execution, and there is no data with the latest date added.
*
* @param int $executionID
* @param string $date
* @access public
* @return void
*/
public function checkCFDData($executionID, $date)
{
$today = helper::today();
if($date >= $today) return;
$checkData = $this->dao->select("date, `count` AS value, `name`")->from(TABLE_CFD)
->where('execution')->eq((int)$executionID)
->andWhere('date')->eq($date)
->orderBy('date DESC, id asc')->fetchGroup('name', 'date');
if(!$checkData)
{
$closetoDate = $this->dao->select("max(date) as date")->from(TABLE_CFD)->where('execution')->eq((int)$executionID)->andWhere('date')->lt($date)->fetch('date');
if($closetoDate)
{
$copyData = $this->dao->select("*")->from(TABLE_CFD)
->where('execution')->eq((int)$executionID)
->andWhere('date')->eq($closetoDate)
->fetchAll();
foreach($copyData as $data)
{
unset($data->id);
$data->date = $date;
$this->dao->replace(TABLE_CFD)->data($data)->exec();
}
}
}
}
/**
* Fix burn for first day.
*