You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by GitBox <gi...@apache.org> on 2022/01/14 09:21:43 UTC

[GitHub] [unomi] jkevan commented on a change in pull request #368: UNOMI-537 Add control groups to personalizations

jkevan commented on a change in pull request #368:
URL: https://github.com/apache/unomi/pull/368#discussion_r784683001



##########
File path: rest/src/main/java/org/apache/unomi/rest/endpoints/ContextJsonEndpoint.java
##########
@@ -378,6 +372,26 @@ private Changes handleRequest(ContextRequest contextRequest, Session session, Pr
         Changes changes = restServiceUtils.handleEvents(contextRequest.getEvents(), session, profile, request, response, timestamp);
         data.setProcessedEvents(changes.getProcessedItems());
 
+        List<PersonalizationService.PersonalizedContent> filterNodes = contextRequest.getFilters();
+        if (filterNodes != null) {
+            data.setFilteringResults(new HashMap<>());
+            for (PersonalizationService.PersonalizedContent personalizedContent : sanitizePersonalizedContentObjects(filterNodes)) {
+                data.getFilteringResults()
+                        .put(personalizedContent.getId(), personalizationService.filter(profile, session, personalizedContent));
+            }
+        }
+
+        List<PersonalizationService.PersonalizationRequest> personalizations = contextRequest.getPersonalizations();
+        if (personalizations != null) {
+            data.setPersonalizations(new HashMap<>());
+            for (PersonalizationService.PersonalizationRequest personalization : sanitizePersonalizations(personalizations)) {
+                PersonalizationResult personalizationResult = personalizationService.personalizeList(profile, session, personalization);
+                changes.setChangeType(changes.getChangeType() | personalizationResult.getChangeType());
+                data.getPersonalizations()
+                        .put(personalization.getId(), personalizationResult.getContentIds());
+            }
+        }
+

Review comment:
       Yes no problem for merging this first. And we will do the additional work in a separate PR as it was not the goal of the current PR.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@unomi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org