Skip to content

Commit 5006968

Browse files
committed
Also count the number of other threads
Previously we counted how many messages the person/team sent to other people's threads, but not the number of threads. Now this new metric is also part of the summary. No new filter added, as the table itself is based on messages, not threads.
1 parent 9091fbe commit 5006968

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

app/controllers/concerns/profile_activity.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,13 @@ def build_activity_summary(scope: nil, filters: nil)
103103
started_thread: 0,
104104
replied_own_thread: 0,
105105
replied_other_thread: 0,
106+
replied_other_topics: 0,
106107
sent_first_patch: 0,
107108
sent_followup_patch: 0
108109
}
109110

111+
replied_other_topic_ids = Set.new
112+
110113
messages.each do |message|
111114
topic = message.topic
112115
next unless topic
@@ -122,9 +125,13 @@ def build_activity_summary(scope: nil, filters: nil)
122125
if filter_symbols.blank? || (activity_types.to_set & filter_symbols).any?
123126
summary[:total] += 1
124127
activity_types.each { |type| summary[type] += 1 }
128+
if activity_types.include?(:replied_other_thread)
129+
replied_other_topic_ids << topic.id
130+
end
125131
end
126132
end
127133

134+
summary[:replied_other_topics] = replied_other_topic_ids.size
128135
summary
129136
end
130137

@@ -134,6 +141,7 @@ def empty_activity_summary
134141
started_thread: 0,
135142
replied_own_thread: 0,
136143
replied_other_thread: 0,
144+
replied_other_topics: 0,
137145
sent_first_patch: 0,
138146
sent_followup_patch: 0
139147
}

app/views/shared/profile/_recent_threads.html.slim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- started = summary[:started_thread] || 0
1919
- replied_own = summary[:replied_own_thread] || 0
2020
- replied_other = summary[:replied_other_thread] || 0
21+
- replied_other_topics = summary[:replied_other_topics] || 0
2122
- first_patch = summary[:sent_first_patch] || 0
2223
- followup_patch = summary[:sent_followup_patch] || 0
2324
.activity-summary
@@ -31,6 +32,9 @@
3132
span.activity-summary-item
3233
span.activity-tag.tag-replied = replied_other
3334
| replied (other)
35+
span.activity-summary-item
36+
span.activity-tag.tag-replied = replied_other_topics
37+
| other threads
3438
span.activity-summary-item
3539
span.activity-tag.tag-patch = first_patch
3640
| first patch

0 commit comments

Comments
 (0)