Skip to content

Commit

Permalink
[FEATURE#114587] Update params
Browse files Browse the repository at this point in the history
On rajoute un param par défaut à null pour la start_date
  • Loading branch information
Jean BILLAUD committed Dec 18, 2018
1 parent f23aaa0 commit bcb81c6
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions src/StudentLogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,37 @@ public function __construct($app)
$this->logger = $app['logs'];
}

public function addLogs($student_id, $type, $duration, $session_id = null, $activity_id = null, array $info_sup = [])
/**
* Create a job to add logs to student.
*
* @param integer $student_id
* @param string $type
* @param integer $duration
* @param mixed $session_id
* @param mixed $activity_id
* @param array $info_sup
* @param mixed $start_date
* @return void
*/
public function addLogs(
$student_id,
$type,
$duration,
$session_id = null,
$activity_id = null,
array $info_sup = [],
$start_date = null
)
{
$now = new \DateTime(date('Y-m-d H:i:s'));
$start = $start_date ?: date('Y-m-d H:i:s');

$job = [
'student_id' => $student_id,
'session_id' => $session_id,
'activity_id' => $activity_id,
'type' => $type,
'duration' => $duration,
'start' => $now->format('Y-m-d H:i:s'),
'start' => $start,
'metas' => $info_sup,
];

Expand Down

0 comments on commit bcb81c6

Please sign in to comment.