The code that stored lastmodified in gradingtable used a different
method to produce it than the processor used to generate the check
value. Fix that and also check that the attempt number has not changed.
When different ID's are set for each sequence a number
of unit test failures appear. They have been corrected
to allow unit tests to pass with the new generator in place.
The changes performed with the change from
create_from_user() to create_from_submission()
in practice enforce a new restriction about
submissions having to exist in order to fire
their lock/unlock events.
This did not exist before the change and, also,
it seems that the assign api itself, submission->lock() ...
also accepts non existing submissions.
So I was not 100% sure about how to fix these events:
1) enforcing submission to exist.
2) firing them only if the submission exist.
I've gone with 1) for now, making tests to pass. But will
raise the question in the Tracker, just in case we have
to move to the 2) approach for any reason.
Also performed the following -
1) Deprecated the assignment's add_to_log function (part of it's functionality exists in the base class to set the legacy log data).
2) Edited existing events to use the new base class.
3) Renamed event_test.php to events_test.php to match the rest of core.
4) Moved the event tests from locallib_test.php to events_test.php.
5) When setting legacy data use lang_string, rather than get_string, as we may not be using them if legacy log is disabled.