This commit is contained in:
tianshujie
2022-06-16 16:06:55 +08:00
parent 61d8ccda45
commit 641c13383b
3 changed files with 30 additions and 6 deletions
+2
View File
@@ -11,3 +11,5 @@ DELETE FROM `zt_workflowaction` WHERE `module`='task' AND `action`='browse';
DELETE FROM `zt_workflowaction` WHERE `module`='build' AND `action`='browse';
ALTER TABLE `zt_projectproduct` MODIFY COLUMN `plan` varchar(255) NOT NULL;
UPDATE `zt_project` SET `grade`=1 WHERE `type` in ('project', 'sprint', 'kanban');
+5 -6
View File
@@ -1335,17 +1335,16 @@ class programModel extends model
/* Process child node path and grade field. */
foreach($childNodes as $childNode)
{
$path = substr($childNode->path, strpos($childNode->path, ",{$programID},"));
$grade = $childNode->grade - $oldGrade + 1;
$path = substr($childNode->path, strpos($childNode->path, ",{$programID},"));
/* Only program sets update grade. */
$grade = $childNode->type == 'program' ? $childNode->grade - $oldGrade + 1 : $childNode->grade;
if($parent)
{
$path = rtrim($parent->path, ',') . $path;
$grade = $parent->grade + $grade;
$grade = $childNode->type == 'program' ? $parent->grade + $grade : $grade;
}
/* Only program sets update grade. */
if($childNode->type != 'program') $grade = $childNode->grade;
$this->dao->update(TABLE_PROGRAM)->set('path')->eq($path)->set('grade')->eq($grade)->where('id')->eq($childNode->id)->exec();
}
+23
View File
@@ -513,6 +513,7 @@ class upgradeModel extends model
break;
case '17_0':
$this->replaceSetLanePriv();
$this->updateGradeOfStage();
break;
}
@@ -6358,4 +6359,26 @@ class upgradeModel extends model
return true;
}
/**
* Update grade of stage.
*
* @access public
* @return void
*/
public function updateGradeOfStage()
{
$allStages = $this->dao->select('*')->from(TABLE_EXECUTION)->where('type')->eq('stage')->fetchAll('id');
$updateIDList = array();
foreach($allStages as $stageID => $stage)
{
if($stage->project != $stage->parent) $updateIDList[$stageID] = $stageID;
}
if(!empty($updateIDList))
{
$this->dao->update(TABLE_EXECUTION)->set('grade')->eq(2)->where('type')->eq('stage')->andWhere('id')->in($updateIDList)->exec();
}
return true;
}
}