-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Collect new statistics for the Contact Identification feature (#…
…33895) Co-authored-by: Pierre Lehnen <55164754+pierre-lehnen-rc@users.noreply.github.com> Co-authored-by: Douglas Fabris <27704687+dougfabris@users.noreply.github.com>
- Loading branch information
1 parent
76f6239
commit 2e4af86
Showing
13 changed files
with
259 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
"@rocket.chat/meteor": minor | ||
"@rocket.chat/core-typings": minor | ||
"@rocket.chat/model-typings": minor | ||
--- | ||
|
||
Adds statistics related to the new **Contact Identification** feature: | ||
- `totalContacts`: Total number of contacts; | ||
- `totalUnknownContacts`: Total number of unknown contacts; | ||
- `totalMergedContacts`: Total number of merged contacts; | ||
- `totalConflicts`: Total number of merge conflicts; | ||
- `totalResolvedConflicts`: Total number of resolved conflicts; | ||
- `totalBlockedContacts`: Total number of blocked contacts; | ||
- `totalPartiallyBlockedContacts`: Total number of partially blocked contacts; | ||
- `totalFullyBlockedContacts`: Total number of fully blocked contacts; | ||
- `totalVerifiedContacts`: Total number of verified contacts; | ||
- `avgChannelsPerContact`: Average number of channels per contact; | ||
- `totalContactsWithoutChannels`: Number of contacts without channels; | ||
- `totalImportedContacts`: Total number of imported contacts; | ||
- `totalUpsellViews`: Total number of "Advanced Contact Management" Upsell CTA views; | ||
- `totalUpsellClicks`: Total number of "Advanced Contact Management" Upsell CTA clicks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
apps/meteor/app/statistics/server/lib/getContactVerificationStatistics.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { IStats } from '@rocket.chat/core-typings'; | ||
import { LivechatContacts } from '@rocket.chat/models'; | ||
|
||
import { settings } from '../../../settings/server'; | ||
|
||
export async function getContactVerificationStatistics(): Promise<IStats['contactVerification']> { | ||
const [ | ||
totalContacts, | ||
totalUnknownContacts, | ||
[{ totalConflicts, avgChannelsPerContact } = { totalConflicts: 0, avgChannelsPerContact: 0 }], | ||
totalBlockedContacts, | ||
totalFullyBlockedContacts, | ||
totalVerifiedContacts, | ||
totalContactsWithoutChannels, | ||
] = await Promise.all([ | ||
LivechatContacts.estimatedDocumentCount(), | ||
LivechatContacts.countUnknown(), | ||
LivechatContacts.getStatistics().toArray(), | ||
LivechatContacts.countBlocked(), | ||
LivechatContacts.countFullyBlocked(), | ||
LivechatContacts.countVerified(), | ||
LivechatContacts.countContactsWithoutChannels(), | ||
]); | ||
|
||
return { | ||
totalContacts, | ||
totalUnknownContacts, | ||
totalMergedContacts: settings.get('Merged_Contacts_Count'), | ||
totalConflicts, | ||
totalResolvedConflicts: settings.get('Resolved_Conflicts_Count'), | ||
totalBlockedContacts, | ||
totalPartiallyBlockedContacts: totalBlockedContacts - totalFullyBlockedContacts, | ||
totalFullyBlockedContacts, | ||
totalVerifiedContacts, | ||
avgChannelsPerContact, | ||
totalContactsWithoutChannels, | ||
totalImportedContacts: settings.get('Contacts_Importer_Count'), | ||
totalUpsellViews: settings.get('Advanced_Contact_Upsell_Views_Count'), | ||
totalUpsellClicks: settings.get('Advanced_Contact_Upsell_Clicks_Count'), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.