TCPReporter
Extends: module:reports/Reporter.Reporter
Source: TCPReporter.js:43
This special case of Reporter connects with an external service reporter providing
the JClic Reports API.
Connection parameters to the reports server (path, service, userId, key, context...)
are passed through the options element of JClicPlayer (acting as JClicPlayer).
Constructor
new TCPReporter(ps: module:JClicPlayer.JClicPlayer): TCPReporterTCPReporter constructor
Parameters
ps(module:JClicPlayer.JClicPlayer) — The JClicPlayer used to retrieve settings and localized messages
Instance Methods
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
addTask(bean: module:report/TCPReporter.ReportBean)
Adds a new element to the list of report beans pending to be transmitted.
Parameters
flushTasksPromise(): external:Promise
Transmits all report beans currently stored in tasks to the reports server
Returns
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
newSession(jcp: module:project/JClicProject.JClicProject)
This method should be invoked when a new session starts.
Parameters
jcp(module:project/JClicProject.JClicProject) — The JClicProject this session refers to.
createDBSession(forceNewSession: boolean): external:Promise
Creates a new session in the remote database and records its ID for future use
Parameters
forceNewSession(boolean) — Whentrue, a new session will always be created.
Returns
end(): external:Promise
Closes this reporting system
Returns
transaction($xml: external:jQuery): external:jqXHR
Performs a transaction on the remote server
Parameters
$xml(external:jQuery) — The XML element to be transmited, wrapped into a jQuery object
Returns
getGroups(): external:Promise
Gets the list of current groups or organizations registered on this reporting system.
Returns
getUsers(+: string): external:Promise
Gets the list of users currently registered in the system, optionally filtered by
a specific group ID.
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.
Parameters
userId(string) — The requested user ID
Returns
stopReporting(): external:Promise
Stops the reporting system, usually as a result of repeated errors or because the player
shuts down.
Returns
reportActivity(flushNow: boolean)
Prepares a ReportBean object with information related to the current
activity, and pushes it into the list of pending tasks, to be processed by the main timer.
Parameters
flushNow(boolean) — Whentrue, the activity data will be sent to server as soon as possible
newActivity(act: module:Activity.Activity)
This method should be invoked when the user starts a new activity
Parameters
act(module:Activity.Activity) — The Activity reporter has just started
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 activitysolved(boolean) —trueif the activity was finally solved,falseotherwise.
Instance Fields
descriptionKey: string
Description of this reporting system
descriptionDetail: string
Additional info to display after the reporter's description
serverPath: string
Main path of the reports server (without protocol nor service)
beforeUnloadFunction: function
Function to be called by the browser before leaving the current page
currentSessionId: string
Identifier of the current session, provided by the server
lastActivity: module:report/ActivityReg.ActivityReg
Last activity reported
actCount: number
Number of activities processed
serviceUrl: string
Service URL of the JClic Reports server
dbProperties: object
Object used to store specific properties of the connected reports system
tasks: Array.<module:report/TCPReporter.ReportBean>
List of ReportBean objects pending to be processed
waitingTasks: Array.<module:report/TCPReporter.ReportBean>
Waiting list of tasks, to be used while tasks is being processed
processingTasks: boolean
Flag used to indicate if transaction is currently running
forceFlush: boolean
Force processing of pending tasks as soon as possible
timer: number
Identifier of the background function obtained with a call to window.setInterval
timerLap: number
Time between calls to the background function, in seconds
failCount: number
Counter of unsuccessful connection attempts with the report server
maxFails: number
Maximum number of failed attempts allowed before disconnecting
DEFAULT_SERVER_PATH: string
Default path of JClic Reports Server
DEFAULT_SERVER_SERVICE: string
Default name for the reports service
DEFAULT_SERVER_PROTOCOL: string
Default server protocol
Use always 'https' except when in 'http' and protocol not set in options
DEFAULT_TIMER_LAP: number
Default lap between calls to flushTasks, in seconds