I am working on a project Online examination just to gain knowledge.
There can be a case of power failure and when a candidate logs in again, then the time wasted during power failure must be given. But in my javascript code, the exam ends after exact 2 hours corresponding to server time(AJAX is used here). After time ends, the student is redirected to home page. I have thought of a solution but I dont find a start to implement it.
As the session is maintained, so I can maintain the time he used from
2 hours and can be stored indatabase. when he relogin then that
particular row which corresponds to him can be checked and the time
can be updated.
But I am not able to implement it. Please tell me if there is another solution to it or the direction in which I am thinking is right or wrong.
The exam clock resumes from the start of 2 hours. It doesn’t resume from the time which was ticking when the power failure was there. Its the same thing whether a power failure occurs or a candidate logs back again in this case atleast. And I am not asking for any code for this problem. I just want a hint or a direction in which I can think of. I just want to know what can be the concept behind it.
Formalizing the problem a bit:
Possible Solution:
Originally thought of a very session-oriented approach, but this might be the way to go: