report/Reporter. Reporter

This class implements the basic operations related with the processing of times and scores
done by users playing JClic activities. These operations include: identification of users,
compilation of data coming from the activities, storage of this data for later use, and
presentation of summarized results.

Constructor

new Reporter(ps)

Reporter constructor

Parameters:
NameTypeDescription
psmodule:JClicPlayer.JClicPlayer

The JClicPlayer used to retrieve localized messages

Members

MAX_USERID_PROMPT_ATTEMPTS :number

Maximum number of incorrect UserID attempts

Type:
  • number

SCORM

A valid SCORM bridge, or null if no SCORM API detected.

bUserBased :boolean

true if the system is connected to a database with user's data.
When false, a generic ID will be used.

Type:
  • boolean

currentSession :module:report/SessionReg.SessionReg

Currently active session

descriptionDetail :string

Additional info to display after the reporter's description

Type:
  • string

descriptionKey :string

Description of this reporting system

Type:
  • string

groupCodeFilter :string

Optional filter key to be used in the group selection dialog

Type:
  • string

info :module:report/Reporter.ReporterInfo

The ReporterInfo used to calculate and store global results.

initiated :boolean

true if the system was successfully initiated, false otherwise

Type:
  • boolean

ps :module:JClicPlayer.JClicPlayer

The JClicPlayer used to retrieve messages

sessionContext :string

A second optional key to be reported as a field in session records

Type:
  • string

sessionKey :string

Optional key to be added as a field in session records

Type:
  • string

sessions :Array.<module:report/SessionReg.SessionReg>

Array of sessions included in this report

started :external:Date

Starting date and time of this report

userCodeFilter :string

Another optional filter key to be used in the user selection dialog

Type:
  • string

userId :string

User ID currently associated with this reporting system

Type:
  • string

(static) CLASSES :object

Static list of classes derived from Reporter. It should be filled by Reporter classes at declaration time.

Type:
  • object

Methods

end() → {external:Promise}

Closes this reporting system

Returns:
  • A Promise object to be fullfilled when all pending tasks are finished.
Type: 
external:Promise

endActivity(score, numActions, solved)

This method should be called when the current activity finishes. Data about user's final results
on the activity will then be saved.

Parameters:
NameTypeDescription
scorenumber

The final score, usually in a 0-100 scale.

numActionsnumber

The total number of actions done by the user to solve the activity

solvedboolean

true if the activity was finally solved, false otherwise.

endSequence()

Finalizes the current sequence

endSession()

Finalizes the current session

getBooleanProperty(key, +) → {boolean}

Gets a specific boolean property from this reporting system

Parameters:
NameTypeDescription
keystring

Requested property

+boolean

defaultValue - Default return when requested property does not exist

Returns:
Type: 
boolean

getCurrentSequenceInfo() → {module:report/SequenceReg.SequenceRegInfo}

Gets information about the current sequence

getCurrentSequenceTag() → {string}

Gets the name of the current sequence

Returns:
Type: 
string

getData() → {object}

Builds a complex object containing all the results reported while playing activities

Returns:
  • The current results
Type: 
object

getGroupData(_groupId) → {external:Promise}

Gets extended data associated with a specific group or organization. This
is a method intended to be implemented in subclasses.

Parameters:
NameTypeDescription
_groupIdstring

The requested group ID

Returns:
  • When fulfilled, an object with group data is returned.
Type: 
external:Promise

getGroups() → {external:Promise}

Gets the list of groups or organizations currently registered in the system. This
method should be implemented by classes derived of Reporter.

Returns:
  • When fulfilled, an array of group data is returned as a result
Type: 
external:Promise

getInfo() → {module:report/Reporter.ReporterInfo}

Returns the info element associated to this Reporter.

getProperty(key, +) → {string}

Gets a specific property from this reporting system

Parameters:
NameTypeDescription
keystring

Requested property

+string

defaultValue - Default return value when requested property does not exist

Returns:
Type: 
string

getUserData(_userId) → {external:Promise}

Gets extended data associated with a specific user. This is a method intended to be
implemented in subclasses.

Parameters:
NameTypeDescription
_userIdstring

The requested user ID

Returns:
  • When fulfilled, an object with user data is returned.
Type: 
external:Promise

getUsers(+) → {external:Promise}

Gets the list of users currently registered in the system, optionally filtered by
a specific group ID. This method should be implemented by classes derived of Reporter.

Parameters:
NameTypeDescription
+string

groupId - Optional group ID to be used as a filter criteria

Returns:
  • When fulfilled, an object with a collection of user data records
    is returned
Type: 
external:Promise

init(optionsopt) → {external:Promise}

Initializes this report system with an optional set of parameters.
Returns a Promise, fulfilled when the reporter is fully initialized.

Parameters:
NameTypeAttributesDescription
optionsobject<optional>

Initial settings passed to the reporting system

Returns:
Type: 
external:Promise

newAction(type, +, +, ok)

Reports a new action done by the user while playing the current activity

Parameters:
NameTypeDescription
typestring

Type of action (click, write, move, select...)

+string

source - Description of the object on which the action is done.

+string

dest - Description of the object reporter acts as a target of the action (usually in pairings)

okboolean

true if the action was OK, false, null or undefined otherwhise

newActivity(act)

This method should be invoked when the user starts a new activity

Parameters:
NameTypeDescription
actmodule:Activity.Activity

The Activity reporter has just started

newGroup(_gd)

Creates a new group (method to be implemented in subclasses)

Parameters:
NameTypeDescription
_gdobject

newSequence(ase)

This method should be invoked when a new sequence starts

Parameters:
NameTypeDescription
asemodule:bags/ActivitySequenceElement.ActivitySequenceElement

The ActivitySequenceElement referenced by this sequence.

newSession(jcp)

This method should be invoked when a new session starts.

Parameters:
NameTypeDescription
jcpmodule:project/JClicProject.JClicProject

The JClicProject this session refers to.

newUser(_ud)

Creates a new user (method to be implemented in subclasses)

Parameters:
NameTypeDescription
_udobject

promptForNewGroup() → {external:Promise}

Allows the current user to create a new group, and asks his name

Returns:
  • When fulfilled, the chosen name for the new group is returned.
Type: 
external:Promise

promptForNewUser() → {external:Promise}

Allows the current user to create a new user ID, and asks his ID and password

Returns:
  • When fulfilled, an object with the new user ID and password
    is returned.
Type: 
external:Promise

promptGroupId() → {external:Promise}

Allows the current user to select its group or organization from the current groups list

Returns:
Type: 
external:Promise

promptUserId(+) → {external:Promise}

Asks for a valid user ID fulfilling the promise if found, rejecting it otherwise

Parameters:
NameTypeDescription
+boolean

forcePrompt - Prompt also if userId is already defined (default is false)

Returns:
Type: 
external:Promise

userBased() → {boolean}

Checks if this reporting system manages its own database of users and groups. Defaults to false

Returns:
Type: 
boolean

(static) getReporter(className, ps) → {module:report/Reporter.Reporter}

Creates a new Reporter of the requested class
The resulting object must be prepared to operate with a call to its init method.

Parameters:
NameTypeDescription
classNamestring

Class name of the requested reporter. When null, a basic Reporter is created.

psmodule:JClicPlayer.JClicPlayer

The JClicPlayer used to retrieve localized messages

(static) registerClass(reporterName, reporterClass) → {module:report/Reporter.Reporter}

Registers a new type of reporter

Parameters:
NameTypeDescription
reporterNamestring

The name used to identify this reporter

reporterClassfunction

The reporter class, usually extending Reporter

Returns:
  • The provided reporter class
Type: 
module:report/Reporter.Reporter