Updated machineDefault/getState but [NOT FINISHED]

This commit is contained in:
xdrm-brackets 2017-02-20 08:21:34 +01:00
parent e208dade95
commit ad13cf0f6e
4 changed files with 20 additions and 3 deletions

View File

@ -28,7 +28,7 @@
/* [1] Creation de l'utilisateur /* [1] Creation de l'utilisateur
=========================================================*/ =========================================================*/
$create_entry = new Repo('history/create', [ $create_entry = new Repo('history/create', [
$id_entry, $id_user,
$id_machine, $id_machine,
$id_action, $id_action,
$timestamp $timestamp

View File

@ -404,6 +404,12 @@
} }
/* (4) STARTED (last state)
---------------------------------------------------------*/
if( count($history) > 0 && $history[0]['id_action'] == $action['start'] )
return [ 'state' => 'started' ];
/* (5) DETACHED (no state) /* (5) DETACHED (no state)
---------------------------------------------------------*/ ---------------------------------------------------------*/
return [ 'state' => 'detached' ]; return [ 'state' => 'detached' ];

View File

@ -41,11 +41,11 @@
$check_history = self::getByTimestamp($timestamp); $check_history = self::getByTimestamp($timestamp);
// Si on trouve pas, erreur // Si on trouve pas, erreur
if( $check_history === false ) if( count($check_history) < 1 )
return false; return false;
// Sinon, on retourne son id // Sinon, on retourne son id
return $check_history['id_history']; return $check_history[0]['id_history'];
} }

View File

@ -510,6 +510,17 @@
}, },
"historyDefault": { "historyDefault": {
"POST::create": {
"description": "Retourne l'historique complet",
"permissions": ["warehouse", "admin"],
"parameters": {
"id_machine": { "description": "Machine UID", "type": "id" },
"id_user": { "description": "User UID", "type": "id" },
"id_action": { "description": "Action UID", "type": "id" },
"timestamp": { "description": "timestamp", "type": "id" }
},
"output": {}
},
"POST::getAll": { "POST::getAll": {
"description": "Retourne l'historique complet", "description": "Retourne l'historique complet",
"permissions": ["warehouse", "admin"], "permissions": ["warehouse", "admin"],