Skip to content
This repository has been archived by the owner on Jan 17, 2019. It is now read-only.

Question: how to keep the best try for each actor #17

Open
jbajou opened this issue Jan 17, 2017 · 0 comments
Open

Question: how to keep the best try for each actor #17

jbajou opened this issue Jan 17, 2017 · 0 comments

Comments

@jbajou
Copy link

jbajou commented Jan 17, 2017

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant