LDEV-257: Priview now works. Previously it had special code for preview which didn't set up a row in the learner session table. Now it calls exactly the same code as learner.
While fixing this I found another bug - when the session is finished it was updating the wrong row in the learner session table. it was getting the row by user, rather than user & session. Now updates the correct row.