mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-22 22:13:59 +00:00
changed the timer to reset for every step
This commit is contained in:
@@ -291,6 +291,7 @@ export default {
|
||||
externalApiResponse: { data: null },
|
||||
timer: null,
|
||||
elapsedTime: 0,
|
||||
stepTime: 0,
|
||||
interval: 1000,
|
||||
sessionId: null,
|
||||
};
|
||||
@@ -298,9 +299,9 @@ export default {
|
||||
computed: {
|
||||
currentQuestion() { return this.questions[this.currentQuestionId] || {}; },
|
||||
formattedTime() {
|
||||
const hours = String(Math.floor(this.elapsedTime / 3600)).padStart(2, '0');
|
||||
const minutes = String(Math.floor((this.elapsedTime % 3600) / 60)).padStart(2, '0');
|
||||
const seconds = String(this.elapsedTime % 60).padStart(2, '0');
|
||||
const hours = String(Math.floor(this.stepTime / 3600)).padStart(2, '0');
|
||||
const minutes = String(Math.floor((this.stepTime % 3600) / 60)).padStart(2, '0');
|
||||
const seconds = String(this.stepTime % 60).padStart(2, '0');
|
||||
return `${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
},
|
||||
@@ -311,7 +312,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
startTimer() { this.timer = setInterval(() => this.elapsedTime++, this.interval); },
|
||||
startTimer() { this.timer = setInterval(() => this.stepTime++, this.interval); },
|
||||
stopTimer() { clearInterval(this.timer); this.timer = null; },
|
||||
startWork() { this.startTimer(); console.log("work is started"); },
|
||||
endWork() { this.stopTimer(); console.log("work is ended"); },
|
||||
@@ -325,12 +326,12 @@ export default {
|
||||
// call api to recorrd timestamp
|
||||
var logBody = {
|
||||
'node': nextQuestionId,
|
||||
'seconds': this.elapsedTime,
|
||||
'seconds': this.stepTime,
|
||||
'userId': this.$store.getters.getUserId,
|
||||
'session_id': this.sessionId,
|
||||
};
|
||||
this.callApi(this.route('api.admin_work_flow.add_workflow_timestamp'), 'post', 'section', logBody, false, false);
|
||||
|
||||
this.stepTime = 0;
|
||||
if (this.questions[nextQuestionId]?.load_api) this.callApi(this.questions[nextQuestionId].load_api, 'get', 'section');
|
||||
},
|
||||
generateSessionId() {
|
||||
|
||||
Reference in New Issue
Block a user