Answers not saved

Bugs Reports and Useful Links

Answers not saved

Postby bendotat » Tue Jul 12, 2016 12:55 pm

We are using efront Edition 3.6.15 Community.
We are using a rather complex exam with all kinds of questions, all in all 2 hours.
The questions are displayed individually.

If you lose your internet connection halfway trough, or close your browser, none of the answers are saved!
Instead, you can resume the test, the time is running at the correct time, but none of the previous answers is saved anywhere in the system.

Is this normal? I would expect the system so save each answer individually.
Please help. The system is in production and said bug is causing all kinds of problems.
Posts: 2
Joined: Tue Jul 12, 2016 12:51 pm

Re: Answers not saved

Postby bendotat » Wed Jul 13, 2016 10:40 am

Could not wait for an answer, so I found a way to implement auto-save.

It seems this feature has been prepared already.

In order to auto-save answers you need to:

Find where it says (but so far only in /* */)
Code: Select all
jQuery('div[id*=question_]').find ...

Remove comment markup and modify this to say:
Code: Select all
jQuery('div[id*=question_]').find('input,select,textarea,div.draggable').on('change', function(event) {
   var current_timestamp = Math.round(new Date().getTime() / 1000);
   if ( (typeof (window.last_autosave) == 'undefined') || ( current_timestamp > window.last_autosave ) ) {
      console.log('autosaving at current_timestamp:' + current_timestamp + ' last save: ' + window.last_autosave);
      window.last_autosave = current_timestamp;'form').attr('action')+'&auto_save=1', jQuery(this).parents('form').serialize());
      console.log('Not autosaving right now (a second hasnt passed yet).');

This is 1 save per second maximum, you might want to tune that (here:
Code: Select all
current_timestamp > window.last_autosave *+ 10*

This doesnt work on wysiwyg, so you might want to remove the wysiwyg css class from test.class.php (ln 5653 replace simpleEditor, ln 5858 add nl2br)
Posts: 2
Joined: Tue Jul 12, 2016 12:51 pm

Return to Bugs

Who is online

Users browsing this forum: No registered users and 2 guests