Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAK-46877 conversations Fix some issues with statistics reporting #13204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adrianfish
Copy link
Contributor

postBean.topic = topicId;
return entityModelForPostBean(conversationsService.savePost(postBean, true));
} catch (Exception e) {
e.printStackTrace();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace with a log message

@@ -116,7 +116,7 @@ export class SakaiTopic extends reactionsAndUpvotingMixin(SakaiElement) {
this.topic.posts = posts;

// We've clicked on a topic and it has no posts. Ergo, it has been "viewed".
if (!this.topic.posts.length) this.topic.viewed = true;
//if (!this.topic?.posts?.length) this.topic.viewed = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment

getEventStats(ConversationsEvents.REACTED_TO_POST, siteId, from, to, userIds).forEach(stat -> {

Long current = reactedPostCountsByUser.getOrDefault(stat.getUserId(), 0L);
current = current + stat.getCount();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
current = current + stat.getCount();
current += stat.getCount();

getEventStats(ConversationsEvents.POST_VIEWED, siteId, from, to, userIds).forEach(stat -> {

Long current = viewedPostCountsByUser.getOrDefault(stat.getUserId(), 0L);
current = current + stat.getCount();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
current = current + stat.getCount();
current += stat.getCount();

getEventStats(ConversationsEvents.REACTED_TO_TOPIC, siteId, from, to, userIds).forEach(stat -> {

Long current = reactedTopicCountsByUser.getOrDefault(stat.getUserId(), 0L);
current = current + stat.getCount();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
current = current + stat.getCount();
current += stat.getCount();

Map<String, Long> topicCountsByUser = new HashMap<>();
topicCreatedStats.forEach(stat -> {
getEventStats(ConversationsEvents.TOPIC_CREATED, siteId, from, to, userIds).forEach(stat -> {

Long current = topicCountsByUser.getOrDefault(stat.getUserId(), 0L);
current = current + stat.getCount();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
current = current + stat.getCount();
current += stat.getCount();

getEventStats(ConversationsEvents.TOPIC_UPVOTED, siteId, from, to, userIds).forEach(stat -> {

Long current = upvotedTopicCountsByUser.getOrDefault(stat.getUserId(), 0L);
current = current + stat.getCount();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
current = current + stat.getCount();
current += stat.getCount();


Map<String, Long> postCountsByUser = new HashMap<>();
postCreatedStats.forEach(stat -> {
getEventStats(ConversationsEvents.POST_CREATED, siteId, from, to, userIds).forEach(stat -> {

Long current = postCountsByUser.getOrDefault(stat.getUserId(), 0L);
current = current + stat.getCount();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
current = current + stat.getCount();
current += stat.getCount();


Long current = reactedCountsByUser.getOrDefault(stat.getUserId(), 0L);
Long current = upvotedPostCountsByUser.getOrDefault(stat.getUserId(), 0L);
current = current + stat.getCount();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
current = current + stat.getCount();
current += stat.getCount();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants