report/ActivityReg. ActivityReg

This class stores miscellaneous data obtained by the current user playing an Activity.

Constructor

new ActivityReg(act)

ActivityReg constructor

Parameters:
NameTypeDescription
actmodule:Activity.Activity

The Activity referenced by this object.

Members

actions :Array.<module:report/ActionReg.ActionReg>

Collection of actions done by the user while playing the activity

closed :boolean

true when the activity has finished, false for the activity that is currently playing

Type:
  • boolean

code :string

Optional code assigned to this activity, used for later filtering

Type:
  • string

lastAction :module:report/ActionReg.ActionReg

Last ActionReg performed by the user in this activity

minActions :number

Minimum number of actions needed to solve the activity

Type:
  • number

name :string

Name of the associated activity

Type:
  • string

numActions :number

Number of actions done by the user playing this activity

Type:
  • number

reportActions :boolean

true when this type of activity should record specific actions done by the users

Type:
  • boolean

score :number

Final score obtained by the current user in this activity

Type:
  • number

solved :boolean

true only when the user has finished and solved the activity

Type:
  • boolean

startTime :number

Timestamp when the user starts playing the activity

Type:
  • number

totalTime :number

Total time spent by the user in the activity, measured in milliseconds

Type:
  • number

Methods

$getXML() → {external:jQuery}

Provides the data associated with the current activity in an XML format suitable for a
JClic Reports Server.

Returns:
Type: 
external:jQuery

closeActivity()

Closes the current activity, adjusting total time if needed

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.

getActionReg(index) → {module:report/ActionReg.ActionReg}

Retrieves a specific ActionReg element from actions

Parameters:
NameTypeDescription
indexnumber

The nth action to be retrieved

getData() → {object}

Builds an object with relevant data about the results obtained by the current student in this activity

Returns:
  • The results of this activity
Type: 
object

getPrecision() → {number}

calculates the final score obtained by the user in this activity.
The algorithm used takes in account the minimal number of actions needed, the actions
really done by the user, and if the activity was finally solved or not.

Returns:
Type: 
number

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 that acts as a target of the action (used in pairings)

okboolean

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

setProperties($xml)

Fills this ActivityReg with data provided in XML format

Parameters:
NameTypeDescription
$xmlexternal:jQuery

The XML element to be processed, already wrapped as jQuery object