modules/session-flow/src/structures/visited-route.ts
User visited route
constructor()
|
getStartTimeString |
getStartTimeString()
|
Return time start string
Returns:
void
|
getEndTimeString |
getEndTimeString()
|
Return time end string
Returns:
void
|
calcDuration |
calcDuration()
|
Calculate time duration on route
Returns:
void
|
getStringObject |
getStringObject()
|
Return object of visited route
Returns:
void
|
duration |
duration: |
Time duration |
route |
route: |
Route name |
timeEnd |
timeEnd: |
Time when user leaved the route |
timeStart |
timeStart: |
Time when user entered to the route |
export class VisitedRoute {
/**
* Route name
*/
route: string;
/**
* Time when user entered to the route
*/
timeStart: Date;
/**
* Time when user leaved the route
*/
timeEnd: Date;
/**
* Time duration
*/
duration: number;
constructor() {
}
/**
* Return time start string
*/
getStartTimeString(){
return this.timeStart.toISOString();
}
/**
* Return time end string
*/
getEndTimeString(){
return this.timeEnd.toISOString();
}
/**
* Calculate time duration on route
*/
calcDuration(){
this.duration = Math.abs(this.timeEnd.getTime() - this.timeStart.getTime());
}
/**
* Return object of visited route
*/
getStringObject(){
let visitedRouteObject = {};
visitedRouteObject['route'] = this.route;
visitedRouteObject['timeStart'] = this.timeStart.toISOString();
visitedRouteObject['timeEnd'] = this.timeEnd.toISOString();
visitedRouteObject['duration'] = this.duration;
return visitedRouteObject;
}
}