Task move position refactoring
This commit is contained in:
@@ -20,32 +20,6 @@ class Board extends Base
|
||||
*/
|
||||
const TABLE = 'columns';
|
||||
|
||||
/**
|
||||
* Save task positions for each column
|
||||
*
|
||||
* @access public
|
||||
* @param array $positions [['task_id' => X, 'column_id' => X, 'position' => X], ...]
|
||||
* @param integer $selected_task_id The selected task id
|
||||
* @return boolean
|
||||
*/
|
||||
public function saveTasksPosition(array $positions, $selected_task_id)
|
||||
{
|
||||
$this->db->startTransaction();
|
||||
|
||||
foreach ($positions as $value) {
|
||||
|
||||
// We trigger events only for the selected task
|
||||
if (! $this->task->movePosition($value['task_id'], $value['column_id'], $value['position'], $value['task_id'] == $selected_task_id)) {
|
||||
$this->db->cancelTransaction();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->closeTransaction();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a board with default columns, must be executed inside a transaction
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user