MCPcopy Create free account
hub / github.com/Rello/analytics / updateData

Method updateData

lib/Service/DataloadService.php:376–407  ·  view source on GitHub ↗

* update data from input form * * @NoAdminRequired * @param int $objectId * @param $dimension1 * @param $dimension2 * @param $value * @param bool $isDataset * @return array|false * @throws \OCP\DB\Exception */

(int $objectId, $dimension1, $dimension2, $value, bool $isDataset)

Source from the content-addressed store, hash-verified

374 * @throws \OCP\DB\Exception
375 */
376 public function updateData(int $objectId, $dimension1, $dimension2, $value, bool $isDataset)
377 {
378 $datasetId = $this->getDatasetId($objectId, $isDataset);
379
380 if ($datasetId != '') {
381 $insert = $update = $errorMessage = 0;
382 $action = array();
383 $value = $this->floatvalue($value);
384 if ($value === false) {
385 $errorMessage = $this->l10n->t('3rd field must be a valid number');
386 } else {
387 $action = $this->StorageService->update($datasetId, $dimension1, $dimension2, $value);
388 $insert = $insert + $action['insert'];
389 $update = $update + $action['update'];
390 }
391
392 $result = [
393 'insert' => $insert,
394 'update' => $update,
395 'error' => $errorMessage,
396 'validate' => $action['validate'],
397 ];
398
399 // Update the Context Chat backend
400 $this->DatasetService->provider($datasetId);
401
402 //if ($errorMessage === 0) $this->ActivityManager->triggerEvent($dataset, ActivityManager::OBJECT_DATA, ActivityManager::SUBJECT_DATA_ADD);
403 return $result;
404 } else {
405 return false;
406 }
407 }
408
409 /**
410 * Simulate delete data from input form

Callers 2

sidebar.jsFile · 0.45

Calls 5

getDatasetIdMethod · 0.95
floatvalueMethod · 0.95
tMethod · 0.45
updateMethod · 0.45
providerMethod · 0.45

Tested by 1