public function OpignoGroupManagerController::updateItemMinScore in Opigno group manager 8
Same name and namespace in other branches
- 3.x src/Controller/OpignoGroupManagerController.php \Drupal\opigno_group_manager\Controller\OpignoGroupManagerController::updateItemMinScore()
Method called when an item success score is set or not.
1 string reference to 'OpignoGroupManagerController::updateItemMinScore'
File
- src/
Controller/ OpignoGroupManagerController.php, line 362
Class
- OpignoGroupManagerController
- Controller for all the actions of the Opigno group manager app.
Namespace
Drupal\opigno_group_manager\ControllerCode
public function updateItemMinScore(Group $group, Request $request) {
// Ensure all data are okay.
$datas = json_decode($request
->getContent());
if (empty($datas->cid)) {
return new JsonResponse(NULL, Response::HTTP_BAD_REQUEST);
}
$cid = $datas->cid;
$success_score_min = empty($datas->successScoreMin) ? 0 : $datas->successScoreMin;
// Update the item.
$content = OpignoGroupManagedContent::load($cid);
$content
->setSuccessScoreMin($success_score_min);
$content
->save();
// Return the JSON response.
return new JsonResponse(NULL, Response::HTTP_OK);
}