Reporter

Source: Reporter.js:44

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: module:JClicPlayer.JClicPlayer): Reporter

Reporter constructor

Parameters


Instance Methods

getInfo(): module:report/Reporter.ReporterInfo

Returns the info element associated to this Reporter.

Returns

getProperty(key: string, +: string): string

Gets a specific property from this reporting system

Parameters

  • key (string) — Requested property
  • + (string) — defaultValue - Default return value when requested property does not exist

Returns

  • string

getBooleanProperty(key: string, +: boolean): boolean

Gets a specific boolean property from this reporting system

Parameters

  • key (string) — Requested property
  • + (boolean) — defaultValue - Default return when requested property does not exist

Returns

  • boolean

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

getUsers(+: string): 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

  • + (string) — groupId - Optional group ID to be used as a filter criteria

Returns

getUserData(_userId: string): external:Promise

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

Parameters

  • _userId (string) — The requested user ID

Returns

getGroupData(_groupId: string): external:Promise

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

Parameters

  • _groupId (string) — The requested group ID

Returns

userBased(): boolean

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

Returns

  • boolean

promptForNewGroup(): external:Promise

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

Returns

promptForNewUser(): external:Promise

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

Returns

promptGroupId(): external:Promise

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

Returns

promptUserId(+: boolean): external:Promise

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

Parameters

  • + (boolean) — forcePrompt - Prompt also if userId is already defined (default is false)

Returns

getData(): object

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

Returns

  • object

init(options?: object): external:Promise

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

Parameters

  • options (object, optional) — Initial settings passed to the reporting system

Returns

end(): external:Promise

Closes this reporting system

Returns

endSequence()

Finalizes the current sequence

endSession()

Finalizes the current session

newGroup(_gd: object)

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

Parameters

  • _gd (object)

newUser(_ud: object)

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

Parameters

  • _ud (object)

newSession(jcp: module:project/JClicProject.JClicProject)

This method should be invoked when a new session starts.

Parameters

newSequence( ase: module:bags/ActivitySequenceElement.ActivitySequenceElement, )

This method should be invoked when a new sequence starts

Parameters

newActivity(act: module:Activity.Activity)

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

Parameters

endActivity(score: number, numActions: number, solved: boolean)

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

Parameters

  • score (number) — The final score, usually in a 0-100 scale.
  • numActions (number) — The total number of actions done by the user to solve the activity
  • solved (boolean) — true if the activity was finally solved, false otherwise.

newAction(type: string, +: string, +: string, ok: boolean)

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

Parameters

  • type (string) — 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)
  • ok (boolean) — true if the action was OK, false, null or undefined otherwhise

getCurrentSequenceInfo( ): module:report/SequenceReg.SequenceRegInfo

Gets information about the current sequence

Returns

getCurrentSequenceTag(): string

Gets the name of the current sequence

Returns

  • string

Static Methods

registerClass( reporterName: string, reporterClass: function, ): module:report/Reporter.Reporter

Registers a new type of reporter

Parameters

  • reporterName (string) — The name used to identify this reporter
  • reporterClass (function) — The reporter class, usually extending Reporter

Returns

getReporter( className: string, ps: module:JClicPlayer.JClicPlayer, ): 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

Returns

Instance Fields

info: module:report/Reporter.ReporterInfo

The ReporterInfo used to calculate and store global results.

ps: module:JClicPlayer.JClicPlayer

The JClicPlayer used to retrieve messages

SCORM

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

userId: string

User ID currently associated with this reporting system

sessionKey: string

Optional key to be added as a field in session records

sessionContext: string

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

groupCodeFilter: string

Optional filter key to be used in the group selection dialog

userCodeFilter: string

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

descriptionKey: string

Description of this reporting system

descriptionDetail: string

Additional info to display after the reporter's description

started: external:Date

Starting date and time of this report

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

Array of sessions included in this report

currentSession: module:report/SessionReg.SessionReg

Currently active session

initiated: boolean

true if the system was successfully initiated, false otherwise

bUserBased: boolean

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

MAX_USERID_PROMPT_ATTEMPTS: number

Maximum number of incorrect UserID attempts

Static Fields

CLASSES: object

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