xAPI-Dashboard
xAPI-Dashboard copied to clipboard
Question: how to keep the best try for each actor
I guys,
I'm having troubles using the ADLCollection and achieving what I want. Here is the thing: I instantiate the collection with some statements returned by an AJAX query to a LRS (I have only statements about the wanted activity, and the 'experienced' verb).
var statements = new ADL.Collection(data);
In these statements, I have multiple statements by actor (each actor tried multiple times the activity... or not), and I would like to keep their best shot at it.
I start by grouping statements by actor. Then i get their max result.score.raw
, and then I'm stuck:
statements.groupBy('actor.account.name').max('result.score.raw');
statements.exec(function (data) {
console.log(data);
});
How can I keep only the best try (i.e. the greatest result.score.raw
) for each Actor ?
Thanks for your help