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
Grouping in Email Digest Agent #1775
Comments
Being about to sort the event sounds like a useful addition, you probably could utilize the |
Is the built in events_order already functioning in this agent? If so then this is probably redundant. I didn't see any sign of it and trying it, I can't really tell if it's working or not. |
I don't think the concern is already in the |
I've been thinking about this for a while now over the holidays. I think the most elegant solution is sorting as in the Data Output Agent where keys for sorting can be input and then sorted. So in the case I've got in mind, I can sort by {{ event.title }} then {{ event.id }} which would group the payloads under each title and they would be in normal sort by id inside that grouping. However I can't really figure out how to dig in deeper as the app is a bit more complex than my skills allow for. How can I even see the methods available for the various objects? Normally I'd just the .methods operator to do introspection but that doesn't seem possible to do in an app like this (or else I'm just too much of a noob). Even at the most basic level I'd like to try something like changing |
The |
Cool thanks. will give it a try this week to start extending
…On Fri, Jan 27, 2017 at 8:24 PM Dominik Sander ***@***.***> wrote:
The payloads variable is an Array of event payloads which are always a
Hash. You can call sort_by
<https://ruby-doc.org/core-2.2.0/Enumerable.html#method-i-sort_by> on
that array: ....pluck(:payload).sort_by {|p| p['title'] }
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1775 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AASBwYuLZSxwxqlYXG0gu3nHmYVYeRLzks5rWlKLgaJpZM4KoUsc>
.
|
@bobbysteel I have a similar use case. My solution was to use a Digest Agent for each source and have its well-formatted output go to a Credential via a JavaScript agent:
Later, when I want the aggregated digest, I have a scheduled JavaScript Agent send an event to an Event Formatting Agent, with contents like this:
This |
good idea, thanks for this! |
Digging this up as I have a few spare cycles now. |
@nogre is this storing the events as an Array? it's hard to tell but it looks like the Credential is holding multiple messages? |
@a10kiloham Changing this line to
should work. You probably also could use a |
Thanks @dsander |
I haven't looked at this in forever and don't remember exactly what's going on, but what is happening in one of my Javascript Agents is:
Basically it as you thought, the identifier is concatenated onto the front of the message with a separator As for multiple array entries, I have other Digest Agents that accept the new entries and clear when the digest is created. So if forum A has multiple posts in the allotted time, then those events get sent to the "forum_A" Digest Agent. Then something else takes the data from all those Digest Agents (forum_A, forum_B, etc.) and makes sense of that. There are filters and formatters somewhere along the line there, too. |
Thanks. I've made it work for now by doing this and adding the keys at the front so I can add a sort | filter to the Digest Agent and I can use that as my grouping. |
I've got a bunch of forum threads I want to bundle up and send to myself periodically with Email Digest Agent. It seems there's a little bit of grouping but order is hard coded as ASC by event.id and there's no sub grouping. I'd like to extend the agent by adding a group_by key that would allow a grouping in the digest if the group_by key is present and then perform a sort by this key. There should probably also be a variable sort_by for ASC or DESC at a minimum. Thoughts on this structure?
The text was updated successfully, but these errors were encountered: