-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[NEW] Livechat Analytics and Reports #11238
Merged
sampaiodiego
merged 59 commits into
RocketChat:develop
from
pkgodara:livechat-analytics
Sep 20, 2018
Merged
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
eb932a8
adding livechat metrics to rooms
pkgodara f09ad74
design prototype
pkgodara 7b30300
design custom daterange popover
pkgodara f91824e
resolve conflicts
pkgodara b7b47c9
resolve conflicts
pkgodara c788bfa
Merge branch 'develop' into livechat-analytics
pkgodara 3b63557
updated package-lock
pkgodara 8777c0d
Merge branch 'develop' into livechat-analytics
pkgodara 61a3920
reactive analytics view
pkgodara 82dbdd0
using i18n translations
pkgodara 3b38fca
fetching and processing analytics data
pkgodara eae93a8
move files together to analytics folder
pkgodara 97b3c56
move configurations to lib
pkgodara 97947fb
separate logic to save last message details
pkgodara 39ce22d
Merge branch 'develop' into livechat-analytics
pkgodara e3b09bd
fix routes
pkgodara 529f543
move chart data functions to lib
pkgodara b0d3ca7
move overview functions to lib
pkgodara 433b5ba
move overview functions to lib
pkgodara f569b84
move client-side functions to lib
pkgodara 9c44791
Add single day chart options
pkgodara 71e4d67
Update design
pkgodara b92bb6b
Update daterange UX
pkgodara 4ad9db3
Update custom daterange UX
pkgodara 56f9c76
Merge branch 'develop' into livechat-analytics
pkgodara 7e6f55a
fix mongo queries date format
pkgodara 7207a52
total msgs chart & responsive overview text
pkgodara de07653
Merge branch 'develop' into livechat-analytics
pkgodara 0a43128
chart and overview box design
pkgodara 91e3bef
overview design, real data in agent overview
pkgodara d4d4810
fix scrollbar, decimals, representation
pkgodara b73ddb4
real-time monitoring
pkgodara 2968549
Merge branch 'develop' into livechat-analytics
pkgodara b024e66
fix time format, agent ranks, real-time charts
pkgodara 35c3d79
Monitoring overview added, fixed reload issue, translations, bug fixes
pkgodara 30cc972
Fix charts
pkgodara cfa500d
total visitors count, fix time formats
pkgodara c06b691
fix date locale
pkgodara b27839e
Fix agent message counts, added new chart option, using export/imports
pkgodara 30024db
fix names, translations
pkgodara bbcb319
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
pkgodara 47ecb6a
Merge branch 'develop' into livechat-analytics
pkgodara 4cca087
fix eslint issues
pkgodara 4b178a7
Merge branch 'develop' into livechat-analytics
renatobecker 8465f9b
merge
pkgodara bb5420a
Merge branch 'livechat-analytics' of https://github.com/pkgodara/Rock…
pkgodara 580f4de
Merge remote-tracking branch 'upstream/develop' into livechat-analytics
pkgodara 01276ce
move message timestamp updates to single method, monitoring subscript…
pkgodara d05a559
fix code format, readability
pkgodara 8459ab4
fix dept enabled check, code format, readability
pkgodara be37a29
fix total visitor count, dept chart updates, analytics data hook
pkgodara e986dfd
fix moment locale
pkgodara 073a5d3
remove moment from server-side
pkgodara 4212b80
fix moment locale, passing ISOStrings
pkgodara 9f6f001
remove meteor from server methods
pkgodara f5349b8
fix indentation
pkgodara 755645e
Merge branch 'develop' into livechat-analytics
sampaiodiego 32688af
Fix lint
sampaiodiego 0857584
Add permission check to publications
sampaiodiego File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,6 +176,30 @@ RocketChat.models.Rooms.saveAnalyticsDataByRoomId = function(roomId, inc, analyt | |
}, update); | ||
}; | ||
|
||
RocketChat.models.Rooms.setLastMessageTimeById = function(room, message) { | ||
const update = { | ||
$set: {} | ||
}; | ||
|
||
// livechat analytics : update last message timestamps | ||
if (room.t === 'l') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems strange checking |
||
const visitorLastQuery = (room.metrics && room.metrics.v) ? room.metrics.v.lq : room.ts; | ||
const agentLastReply = (room.metrics && room.metrics.servedBy) ? room.metrics.servedBy.lr : room.ts; | ||
|
||
if (message.token) { // update visitor timestamp, only if its new inquiry and not continuing message | ||
if (agentLastReply >= visitorLastQuery) { // if first query, not continuing query from visitor | ||
update.$set['metrics.v.lq'] = message.ts; | ||
} | ||
} else if (visitorLastQuery > agentLastReply) { // update agent timestamp, if first response, not continuing | ||
update.$set['metrics.servedBy.lr'] = message.ts; | ||
} | ||
} | ||
|
||
return this.update({ | ||
_id: room._id | ||
}, update); | ||
}; | ||
|
||
/** | ||
* total no of conversations between date. | ||
* @param {string, {ISODate, ISODate}} t - string, room type. date.gte - ISODate (ts >= date.gte), date.lt- ISODate (ts < date.lt) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about updating the
room
here and below again .. Why not just update once?I see you're checking
message.token
, but you're doing this insetLastMessageTimeById
too, so why not just update the analytics data once?