37 string $a_obj_type =
'' 51 public static function _getProgress(
int $a_user_id,
int $a_obj_id): array
56 foreach ($events as $row) {
64 $progress[
'spent_seconds'] += (
int) $row[
'spent_seconds'];
65 $progress[
'access_time'] = max(
66 $progress[
'access_time'],
67 (
int) $row[
'last_access']
69 $progress[
'access_time_min'] = min(
70 $progress[
'access_time_min'],
71 (
int) $row[
'first_access']
74 $progress[
'obj_id'] = (
int) $row[
'obj_id'];
75 $progress[
'user_id'] = (
int) $row[
'usr_id'];
76 $progress[
'spent_seconds'] = (
int) $row[
'spent_seconds'];
77 $progress[
'access_time'] = (
int) $row[
'last_access'];
78 $progress[
'access_time_min'] = (
int) $row[
'first_access'];
79 $progress[
'visits'] = (
int) $row[
'read_count'];
92 if (isset($progress[$row[
'usr_id']])) {
93 $progress[$row[
'usr_id']][
'spent_seconds'] += (
int) $row[
'spent_seconds'];
94 $progress[$row[
'usr_id']][
'read_count'] += (
int) $row[
'read_count'];
95 $progress[$row[
'usr_id']][
'ts'] = max(
96 (
int) $row[
'last_access'],
97 (
int) $progress[$row[
'usr_id']][
'ts']
100 $progress[$row[
'usr_id']][
'spent_seconds'] = (
int) $row[
'spent_seconds'];
101 $progress[$row[
'usr_id']][
'read_count'] = (
int) $row[
'read_count'];
102 $progress[$row[
'usr_id']][
'ts'] = (
int) $row[
'last_access'];
104 $progress[$row[
'usr_id']][
'usr_id'] = (
int) $row[
'usr_id'];
105 $progress[$row[
'usr_id']][
'obj_id'] = (
int) $row[
'obj_id'];
static _getProgress(int $a_user_id, int $a_obj_id)
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
static setInProgressIfNotAttempted(int $a_obj_id, int $a_user_id)
This function shoudl be clalled for normal "read events".
static _lookupReadEvents($obj_id, $usr_id=null)
Reads all read events which occured on the object.
static _lookupProgressByObjId(int $a_obj_id)
lookup progress for a specific object