-
Ryan Smith authored
BREAKING CHANGE: Removes some statements.
Ryan Smith authoredBREAKING CHANGE: Removes some statements.
Guide to Changing Statements
So you've found a statement that you'd like to change. If you're not comfortable with PHP or can't get to grips with Moodle's logstore, then you should probably ask for the change in a new issue via our Github issue tracker and hopefully someone will have some time to make the changes you require.
If PHP and the logstore aren't scaring you away
Now hold your horses git checkout master && git pull && git checkout -b A_BRANCH_NAME_FOR_YOUR_CHANGES
.
With the house keeping taken care of you now need to track down the transformer for the statement. We've tried to make tracking this down a piece of cake statement.context.extensions
there is a property with the URL of http://lrs.learninglocker.net/define/extensions/info
. Inside that property is a property called event_function
and the value of that will be something like \\src\\transformer\\events\\mod_quiz\\attempt_submitted
. This value is the file path to the function that transforms the logstore event into an array of xAPI statements. If you look inside the src
directory of the plugin you should be able to follow this file path to the function that you'll need to change. For the value above that takes you to the attempt_submitted
transformer.
Once you've tracked down the transformer, make the changes you require and then test those changes by running ./vendor/bin/phpunit
in your terminal from inside the plugin directory. You'll probably need to change the tests a little in order for them to pass since the tests check the properties and values of the statement. To change the tests, take a look in the tests
directory of the plugin, you'll find that it's structured very similarly to the src/transformer
directory. You should also notice that each test is made up of 4 files, this is explained in our testing guide.
When you've got those pesky tests passing again git add -A && git commit -am "A_DESCRIPTION_OF_YOUR_CHANGES && git push"
. To make a pull request you can follow Github's guide for creating a pull request from a fork. Once your pull request is made, your changes will be reviewed and merged by a maintainer.
If you're having some issues with this guide, we're really sorry