( accumulators: Map<string, ContactAccumulator>, sessionId: string, meta: ContactsSessionMetaFacts, sessionFacts: ContactsCachedGroupFacts[] )
| 302 | } |
| 303 | |
| 304 | function applyGroupFacts( |
| 305 | accumulators: Map<string, ContactAccumulator>, |
| 306 | sessionId: string, |
| 307 | meta: ContactsSessionMetaFacts, |
| 308 | sessionFacts: ContactsCachedGroupFacts[] |
| 309 | ): void { |
| 310 | for (const facts of sessionFacts) { |
| 311 | if (!hasGroupContactSignal(facts)) continue |
| 312 | const acc = getOrCreateAccumulator(accumulators, sessionId, meta, facts.contact) |
| 313 | acc.commonGroupSessionIds.add(sessionId) |
| 314 | acc.coOccurrenceCount += facts.coOccurrenceCount |
| 315 | acc.coOccurrenceRawScore += facts.coOccurrenceRawScore |
| 316 | acc.replyInteractionCount += facts.replyInteractionCount |
| 317 | acc.repliesFromOwnerToContact += facts.repliesFromOwnerToContact |
| 318 | acc.repliesFromContactToOwner += facts.repliesFromContactToOwner |
| 319 | updateLastInteraction(acc, facts.lastInteractionTs) |
| 320 | acc.sourceSessions.push({ |
| 321 | id: sessionId, |
| 322 | name: meta.name, |
| 323 | platform: meta.platform, |
| 324 | type: ChatType.GROUP, |
| 325 | messageCount: facts.messageCount, |
| 326 | coOccurrenceCount: facts.coOccurrenceCount, |
| 327 | coOccurrenceRawScore: facts.coOccurrenceRawScore, |
| 328 | replyInteractionCount: facts.replyInteractionCount, |
| 329 | repliesFromOwnerToContact: facts.repliesFromOwnerToContact, |
| 330 | repliesFromContactToOwner: facts.repliesFromContactToOwner, |
| 331 | lastInteractionTs: facts.lastInteractionTs, |
| 332 | }) |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | function hasGroupContactSignal(facts: ContactsCachedGroupFacts): boolean { |
| 337 | return facts.messageCount > 0 || facts.coOccurrenceCount > 0 || facts.replyInteractionCount > 0 |
no test coverage detected