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

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

@jbajou

Description

@jbajou

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions