-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LoggedIn and LoggedOut no longer works #83
Comments
@jlowe64 assigned this to you because I know you're doing some work on the plugin at the moment, hope that's ok 😄 |
The last statement I have in my Moodle sandbox with the verb https://brindlewaye.com/xAPITerms/verbs/loggedin/ is 3 months ago. I'm working with that sandbox quite regularly so it seems like this is broken for me too. |
I've run in to that problem before. I think it's because the name integration has to be included in the event. I'll take a look to see what I did to fix it. I've seen this before, some where else, when I was including it. |
I've seen the fullname function for moodle not work before programming something to run on CLI. I'm looking on Moodle-log-expander Repository.php on line 49-51. /**
* Calls the Moodle core fullname function
* @param PHPObj $user
* @return Str
*/
protected function fullname($user) {
return fullname($user);
} The other question is I see this, |
Other events are using the fullname function; I don't think this is to blame.
|
I can confirm I am having the same issue. I'm looking to see where the break is happening. I am not even seeing the information in the LRS. PHP v. 5.6.19 Moodle (3.0.6 (Build: 20160912): LearningLocker v. 1.14.0 LRS statement: Admin User viewed local test site | 8 seconds ago (Mon, Nov 14, 2016 5:12 PM) I need to fix the time issue on the LRS, it's currently on ZULU time. But the log in events are not appearing when they should, I do notice a lag when the site is signing in, so there might be a error that is not triggering the debug report to be displayed. Maybe a translation issue? I have time so I'll look through and see what is going on. EDIT: |
I found the issue or at least a part of it. Okay, so after enabling xdebug and stepping through the web calls with xapi enabled with in moodle. I discovered the event is not even being triggered. The event goes through base \core\event\base trigger, and appears to stop at events_trigger_legacy($legacyeventname, $this->get_legacy_eventdata()); on line 809 of base.php. I have break points on both event.php of the MXTranslator\Events\Event and user_loggedin and user_loggedout and none of them trigger during sign-in/out. The store.php file in the main xapi plugin does hit the break point in the constructor and then goes to \tool_log\log\manager.php. It then leaves and goes to the base.php where it stays and does not return for any of the xapi portions. So, something is going on where it's wanting to hang inside base.php and not return back to the xapi plugin to do any of that event recording. However, on the userloggedin event, it is getting a null value for legacy log. but user logged out is triggering this condition: if (isset($this->stores['logstore_legacy'])) {
$this->stores['logstore_legacy']->legacy_add_to_log($courseid, $module, $action, $url, $info, $cm, $user, $ip, $time);
} and hits the legacy log portion in base.php in the trigger() function. Course viewed goes to the public function read() in the translator. But for some reason those two events are not triggering the same response. I will keep looking as to what values are different. Since I finally got xdebug to work with phpstorm and the built in server. |
great work @caperneoignis! |
More details, after many minutes of many moons of stepping through the lines of code, that separate course_viewed event from user_loggedin and user_loggedout, I have determined these items.
user_loggedin and user_loggedout are both in the array however! The event course_viewed is not! in fact when processing the observingclasses when it gets to \core\event\course_viewed it exits early on line 127. I don't know if that plays a part in this, but I find it weird out of the three events, course_viewed is the only one getting inputted into the LRS from the logstore_xapi plugin. All three events hit the writer function I listed early in \tool_log\log\manager. This is called from line 158 of the \core\event\manager method. So I can only assume, when it 'writes' it is causing xapi to gloss over the event as already being recorded? Because when I step through all the steps, which is very long and drawn out, so I could have missed something, logstore_xapi pops up all the time. It looks like it's being called every event, however, when I keep stepping through and the page finally loads, that is when the break point i had set in events.php in the translator namespace actually gets triggered. So the only thing I can think of, is because the two events get called and processed in the buffer in the event\manager.php file, that they don't cause an event trigger within the xapi plugin. I would think while processing the buffers, the plugin would be called then with the |
Okay! These are the only two events I could find within the array $allobservers '\core\event\user_loggedin' => 'UserLoggedin',
'\core\event\user_loggedout' => 'UserLoggedout', The rest of the routs listed in \MXTranslator\Controller are not in that array. Which makes me lean in the direction that the processing of the buffers is what is causing the user_loggedin and user_loggedout to not be processed correctly. I hope this helps narrow down the issue. Because I'm not sure why its happening and why it's only these two items. I find it quite odd to say the least. But if anyone has any idea of how to fix it, I'll be more then happy to test. |
Thanks for the additional info @caperneoignis 👍 |
The plot thickens! Turned the option to transmit events during a task, option on, and guess what I saw!
But for some reason, this is not sending them out, even on task execution. I'll look to see why that is, maybe it will give me a better view since it's more top down. |
Found it! /**
* Reads an object from the store with the given type and query.
* @param String $type
* @param [String => Mixed] $query
* @return PhpObj
*/
protected function readStoreRecord($type, array $query) {
$model = $this->store->get_record($type, $query);
if ($model === false) {
throw new Exception('Record not found.');
}
return $model;
} It is throwing an exception on user_loggedin and user_logged out, because it can not find course with id=0. exact xdebug_message:
So it appears the read course is throwing an error because it can not find the record. I will see if there is a way around that. Maybe a default value? $model = $this->store->get_record($type, $query); This is the line that throws. I thought it was weird it kept jumping back from there, even though I was using step over and then step in. Then I saw the exception, under $e. I will see what I can do to fix it. UPDATE: Made the fix and included it with my PR in expander. |
@caperneoignis that is awesome! Really good digging! 👍 ✋ 😄 😸 😃 😺 🎈 I hope those emojis demonstrate how grateful I am that you found the problem |
HAhahahaha Thanks @ryansmith94! I appreciate it. It took a minute, I was pretty happy I finally found it. |
is this, or will be, merged? I am waiting for this fix. |
It will be, I just don't have any time to work on this repository right now unfortunately |
This is fixed as of v1.2.0. Closing |
Find another bug in this last minor version which integrate the name of the agent instead of his login:
LoggedIn & LoggedOut don't works now. Is it the same for you ?
They works in the previous version.
The text was updated successfully, but these errors were encountered: