diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b9dc7a5..cab9f5e 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,14 +12,7 @@ If you have a good idea for improvement feel free to create a new issue with all ### Issues -Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the code and have the following structure: - -```php -/** - * @todo Orange-Management/Orange-Management#ISSUE_NUMBER [d:difficulty] - * Description for the issue - */ -``` +Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the `Project.md` file in the `Docs` repository. The issue information can be used to provide additional information such as priority, difficulty and type. For your first issue try to find a issue marked `[d:first]` or `[d:beginner]`. diff --git a/Controller/ApiController.php b/Controller/ApiController.php index ca4b827..f34eafd 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -371,7 +371,7 @@ final class ApiController extends Controller } /** - * Api method to update a task + * Api method to update a task element * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -389,13 +389,19 @@ final class ApiController extends Controller $new = $this->updateTaskElementFromRequest($request); $this->updateModel($request->header->account, $old, $new, TaskElementMapper::class, 'taskelement', $request->getOrigin()); - /** - * @todo Orange-Management/oms-Tasks#2 - * Update task status depending on the new task element or updated task element - * The task status is not normalized and relates to the last task element. - * Depending on the task status of the last task element also the task status should change. - */ - //$this->updateModel($request->header->account, $task, $task, TaskMapper::class, 'task', $request->getOrigin()); + if ($old->getSatus() !== $new->getStatus() + || $old->getPriority() !== $new->getPriority() + || $old->getDue() !== $new->getDue() + ) { + $task = TaskMapper::get($new->task); + + $task->setStatus($new->getStatus()); + $task->setPriority($new->getPriority()); + $task->due = $new->due; + + $this->updateModel($request->header->account, $task, $task, TaskMapper::class, 'task', $request->getOrigin()); + } + $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Task element', 'Task element successfully updated.', $new); }