Reputation: 939
In an online examination system how could i handle exam elapsed and remaining time.
At the first i managed to solve this problem by using javascript to setup a client side timer in the exam web page at the moment the student come in the exam page and notify server by using ajax in every interval of that timer; so i could update exam duration of current student.
Everything seems OK but the problem becomes apparent when a curious student disables javascript in Browser during exam and re enable it before clicking submit button. hence timer stops and browser could not send ajax requests to the server.
What's the best way to handle this problem ?
Thanks in advance.
Upvotes: 3
Views: 205
Reputation: 51634
Upvotes: 3
Reputation: 19862
JavaScript can be disabled in the browser and you cannot do anything about it.
However, you can record the start time of the paper somewhere (probably a DB) and when the page is submitted (After a user is finished answering the paper), get the duration that was taken for the question paper to be answered. You know how much time was taken to submit the paper.
Give a grace period of let's say +2 minutes and if the time taken is more than what was allocated, show a message showing "Try again! Next time!".
Upvotes: 2
Reputation: 41767
A naive approach would be to include the start time as a form parameter in your web pages, and then calculate the duration based on this time, however this is also subject to curious students using a DOM editing tool to change this value.
You'll need some form of persistence in your application - possibly a database. If you persist the time that the student started you can just use this value when any subsequent requests come in.
Upvotes: 1