Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
221
Issues
221
List
Boards
Labels
Service Desk
Milestones
Merge Requests
34
Merge Requests
34
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
85d20c0a
Commit
85d20c0a
authored
5 hours ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat): store activity owner_guid for all views - closes
#822
parent
61f0bd82
epic/affiliates
1 merge request
!326
(feat): store activity owner_guid for all views - closes #822
Pipeline
#82435804
passed with stages
in 13 minutes and 33 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
15 deletions
+37
-15
views.php
Controllers/api/v2/analytics/views.php
+2
-0
ElasticRepository.php
Core/Analytics/Views/ElasticRepository.php
+1
-0
Repository.php
Core/Analytics/Views/Repository.php
+3
-1
View.php
Core/Analytics/Views/View.php
+5
-0
cassandra-provision.cql
Core/Provisioner/Provisioners/cassandra-provision.cql
+2
-0
RepositorySpec.php
Spec/Core/Analytics/Views/RepositorySpec.php
+24
-14
No files found.
Controllers/api/v2/analytics/views.php
View file @
85d20c0a
...
...
@@ -53,6 +53,7 @@ class views implements Interfaces\Api
$viewsManager
->
record
(
(
new
Core\Analytics\Views\View
())
->
setEntityUrn
(
$boost
->
getEntity
()
->
getUrn
())
->
setOwnerGuid
((
string
)
$boost
->
getEntity
()
->
getOwnerGuid
())
->
setClientMeta
(
$_POST
[
'client_meta'
]
??
[])
);
}
catch
(
\Exception
$e
)
{
...
...
@@ -105,6 +106,7 @@ class views implements Interfaces\Api
$viewsManager
->
record
(
(
new
Core\Analytics\Views\View
())
->
setEntityUrn
(
$activity
->
getUrn
())
->
setOwnerGuid
((
string
)
$activity
->
getOwnerGuid
())
->
setClientMeta
(
$_POST
[
'client_meta'
]
??
[])
);
}
catch
(
\Exception
$e
)
{
...
...
This diff is collapsed.
Click to expand it.
Core/Analytics/Views/ElasticRepository.php
View file @
85d20c0a
...
...
@@ -55,6 +55,7 @@ class ElasticRepository
'uuid'
=>
$view
->
getUuid
(),
'@timestamp'
=>
$view
->
getTimestamp
()
*
1000
,
'entity_urn'
=>
$view
->
getEntityUrn
(),
'owner_guid'
=>
$view
->
getOwnerGuid
(),
'page_token'
=>
$view
->
getPageToken
(),
'campaign'
=>
$view
->
getCampaign
(),
'delta'
=>
(
int
)
$view
->
getDelta
(),
...
...
This diff is collapsed.
Click to expand it.
Core/Analytics/Views/Repository.php
View file @
85d20c0a
...
...
@@ -104,6 +104,7 @@ class Repository
->
setDay
((
int
)
$row
[
'day'
]
?:
null
)
->
setUuid
(
$row
[
'uuid'
]
->
uuid
()
?:
null
)
->
setEntityUrn
(
$row
[
'entity_urn'
])
->
setOwnerGuid
(
$row
[
'owner_guid'
])
->
setPageToken
(
$row
[
'page_token'
])
->
setPosition
((
int
)
$row
[
'position'
])
->
setSource
(
$row
[
'platform'
])
...
...
@@ -135,13 +136,14 @@ class Repository
$timestamp
=
$view
->
getTimestamp
()
?:
time
();
$date
=
new
DateTime
(
"@
{
$timestamp
}
"
,
new
DateTimeZone
(
'utc'
));
$cql
=
"INSERT INTO views (year, month, day, uuid, entity_urn,
page_token, position, platform, source, medium, campaign, delta) VALUES (
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
;
$cql
=
"INSERT INTO views (year, month, day, uuid, entity_urn,
owner_guid, page_token, position, platform, source, medium, campaign, delta) VALUES (?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
;
$values
=
[
(
int
)
(
$view
->
getYear
()
??
$date
->
format
(
'Y'
)),
new
Tinyint
((
int
)
(
$view
->
getMonth
()
??
$date
->
format
(
'm'
))),
new
Tinyint
((
int
)
(
$view
->
getDay
()
??
$date
->
format
(
'd'
))),
new
Timeuuid
(
$view
->
getUuid
()
??
$timestamp
*
1000
),
$view
->
getEntityUrn
()
?:
''
,
(
string
)
(
$view
->
getOwnerGuid
()
??
''
),
$view
->
getPageToken
()
?:
''
,
(
int
)
(
$view
->
getPosition
()
??
-
1
),
$view
->
getPlatform
()
?:
''
,
...
...
This diff is collapsed.
Click to expand it.
Core/Analytics/Views/View.php
View file @
85d20c0a
...
...
@@ -21,6 +21,8 @@ use Minds\Traits\MagicAttributes;
* @method string getUuid()
* @method View setEntityUrn(string $entityUrn)
* @method string getEntityUrn()
* @method View setOwnerGuid(string $ownerGuid)
* @method string getOwnerGuid()
* @method View setPageToken(string $pageToken)
* @method string getPageToken()
* @method View setPosition(int $position)
...
...
@@ -57,6 +59,9 @@ class View
/** @var string */
protected
$entityUrn
;
/** @var string */
protected
$ownerGuid
;
/** @var string */
protected
$pageToken
;
...
...
This diff is collapsed.
Click to expand it.
Core/Provisioner/Provisioners/cassandra-provision.cql
View file @
85d20c0a
...
...
@@ -1445,3 +1445,5 @@ CREATE TABLE minds.email_campaign_logs (
email_campaign_id text,
PRIMARY KEY (receiver_guid, time_sent)
) WITH CLUSTERING ORDER BY (time_sent desc);
ALTER TABLE minds.views ADD owner_guid text;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Spec/Core/Analytics/Views/RepositorySpec.php
View file @
85d20c0a
...
...
@@ -61,6 +61,10 @@ class RepositorySpec extends ObjectBehavior
->
shouldBeCalled
()
->
willReturn
(
'urn:test:123123'
);
$view
->
getOwnerGuid
()
->
shouldBeCalled
()
->
wilLReturn
(
'789'
);
$view
->
getPageToken
()
->
shouldBeCalled
()
->
willReturn
(
'1234-qwe-qwe-1234'
);
...
...
@@ -98,13 +102,14 @@ class RepositorySpec extends ObjectBehavior
$statement
[
'values'
][
2
]
->
toInt
()
===
29
&&
$statement
[
'values'
][
3
]
->
uuid
()
===
'abc-123-456-def'
&&
$statement
[
'values'
][
4
]
===
'urn:test:123123'
&&
$statement
[
'values'
][
5
]
===
'1234-qwe-qwe-1234'
&&
$statement
[
'values'
][
6
]
===
5
&&
$statement
[
'values'
][
7
]
===
'php'
&&
$statement
[
'values'
][
8
]
===
'phpspec'
&&
$statement
[
'values'
][
9
]
===
'test'
&&
$statement
[
'values'
][
10
]
===
'urn:phpspec:234234'
&&
$statement
[
'values'
][
11
]
===
100
;
$statement
[
'values'
][
5
]
===
'789'
&&
$statement
[
'values'
][
6
]
===
'1234-qwe-qwe-1234'
&&
$statement
[
'values'
][
7
]
===
5
&&
$statement
[
'values'
][
8
]
===
'php'
&&
$statement
[
'values'
][
9
]
===
'phpspec'
&&
$statement
[
'values'
][
10
]
===
'test'
&&
$statement
[
'values'
][
11
]
===
'urn:phpspec:234234'
&&
$statement
[
'values'
][
12
]
===
100
;
}),
true
)
->
shouldBeCalled
()
->
willReturn
(
true
);
...
...
@@ -143,6 +148,10 @@ class RepositorySpec extends ObjectBehavior
->
shouldBeCalled
()
->
willReturn
(
'urn:test:123123'
);
$view
->
getOwnerGuid
()
->
shouldBeCalled
()
->
willReturn
(
789
);
$view
->
getPageToken
()
->
shouldBeCalled
()
->
willReturn
(
'1234-qwe-qwe-1234'
);
...
...
@@ -180,13 +189,14 @@ class RepositorySpec extends ObjectBehavior
$statement
[
'values'
][
2
]
->
toInt
()
===
29
&&
$statement
[
'values'
][
3
]
->
time
()
===
$now
*
1000
&&
$statement
[
'values'
][
4
]
===
'urn:test:123123'
&&
$statement
[
'values'
][
5
]
===
'1234-qwe-qwe-1234'
&&
$statement
[
'values'
][
6
]
===
5
&&
$statement
[
'values'
][
7
]
===
'php'
&&
$statement
[
'values'
][
8
]
===
'phpspec'
&&
$statement
[
'values'
][
9
]
===
'test'
&&
$statement
[
'values'
][
10
]
===
'urn:phpspec:234234'
&&
$statement
[
'values'
][
11
]
===
100
;
$statement
[
'values'
][
5
]
===
'789'
&&
$statement
[
'values'
][
6
]
===
'1234-qwe-qwe-1234'
&&
$statement
[
'values'
][
7
]
===
5
&&
$statement
[
'values'
][
8
]
===
'php'
&&
$statement
[
'values'
][
9
]
===
'phpspec'
&&
$statement
[
'values'
][
10
]
===
'test'
&&
$statement
[
'values'
][
11
]
===
'urn:phpspec:234234'
&&
$statement
[
'values'
][
12
]
===
100
;
}),
true
)
->
shouldBeCalled
()
->
willReturn
(
true
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment