Code Monkey home page Code Monkey logo

moodle-enrol_arlo's People

Contributors

chocolate-lightning avatar cybercorey avatar dvdcastro avatar ericmerrill avatar germanvaleroelizondo avatar hitteshahuja avatar hitteshahujatca avatar kingdavid127 avatar noisyjerm avatar ojnadjarm avatar troywilliams avatar vinod4 avatar vinod404 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

moodle-enrol_arlo's Issues

Arlo to Moodle Synchronization is taking too long to complete

  • From testing results it looks like it's syncing 100 registrants every 20 minutes. This won't be fast enough for our clients if they have an event that has 7,000 registrants and they kick off a sync at 4 pm it needs to be complete by the next work morning of 8 am.

Patch issue - Bad Request 400

PATCH https://lwarlo.arlo.co/api/2012-02-01/auth/resources/registrations/31/

<?xml version="1.0" encoding="utf-8"?>
<diff>
    <replace sel="Registration/LastActivityDateTime/text()[1]">2017-07-11T02:55:08+0000</replace>
    <replace sel="Registration/ProgressStatus/text()[1]">In progress</replace>
    <replace sel="Registration/ProgressPercent/text()[1]">33</replace>
</diff>

Response

<?xml version="1.0" encoding="utf-8"?>
<ApiException>
<Code>BadRequest</Code>
<Message>Path Registration/LastActivityDateTime/text()[1] did not match a node (line = 2, position = 8)</Message>
</ApiException>

I have been using patch example from: https://developer.arlo.co/doc/api/2012-02-01/auth/resources/registrations there is nothing obvious to me in request and I don't really have time to read throught rfc5261.

Is this because fields have no data yet. Should I be using add?
https://lwarlo.arlo.co/api/2012-02-01/auth/resources/registrations/31/?expand=Registration

<?xml version="1.0" encoding="utf-8"?>
<Registration>
    <RegistrationID>31</RegistrationID>
    <UniqueIdentifier>d0d1c8c0-94db-4d00-8706-c3a5e28f8a65</UniqueIdentifier>
    <Attendance>Unknown</Attendance>
    <Status>Approved</Status>
    <CreatedDateTime>2017-07-10T02:56:06.045Z</CreatedDateTime>
    <Link rel="self" type="application/xml" href="https://lwarlo.arlo.co/api/2012-02-01/auth/resources/registrations/31/"/>
    <Link rel="http://schemas.arlo.co/api/2012/02/auth/related/CustomFields" type="application/xml" title="CustomFields" href="https://lwarlo.arlo.co/api/2012-02-01/auth/resources/registrations/31/customfields/"/>
    <Link rel="http://schemas.arlo.co/api/2012/02/auth/related/Event" type="application/xml" title="Event" href="https://lwarlo.arlo.co/api/2012-02-01/auth/resources/events/1/"/>
    <Link rel="http://schemas.arlo.co/api/2012/02/auth/related/Contact" type="application/xml" title="Contact" href="https://lwarlo.arlo.co/api/2012-02-01/auth/resources/contacts/33/"/>
    <Link rel="http://schemas.arlo.co/api/2012/02/auth/related/SourceInfo" type="application/xml" title="SourceInfo" href="https://lwarlo.arlo.co/api/2012-02-01/auth/resources/registrations/31/sourceinfo/"/>
</Registration>

Multiple users matches Moodle side handling confirmation

When the plugin attempts to match Arlo contacts against a Moodle user there is the possibility that Moodle could find more than one match.

In Moodle there is a setting "allowaccountssameemail" by default it is set to false. And still, this may be enforced by the Moodle UI but not by other plugins that create Moodle user accounts.

In some organisations, they have integrations to SMS, HR systems etc. Users can have multiple Moodle accounts that have same information attached such as first name, last name and email.

The two options are:

  1. Match on Moodle account with the latest activity
  2. Create a new account.

Thoughts?

Develop XML Deserializer

Development code that can parse XML responses from Arlo AuthAPI and serialize to Collection and Resource objects.

Registrants of associated template do not get synced to Moodle

Steps:

  1. Create an online activity without using a template
  2. Create an event using the created template from step 1
  3. Create a Moodle course
  4. Go to Course admin > Associate Arlo Template
  5. Link Moodle course to Arlo Template
  6. Add Arlo registrations on the event and online activity
  7. Go to Course admin > Users > Enrolled users and check

EXPECTED:
Registrations should sync

ACTUAL:
Registrations are not synced

Moodle course:
https://dev-arlo.elearning.ac.nz/course/view.php?id=19

Arlo template:
https://arlomoodleqa.builds.arlosoftware.net/management/Console/#/templates/1015

Initial plugin settings labels, styling and field changes

The changes below have been suggested to help make the Arlo connection process as simple as possible.

  1. Remove "Platform FQDN" and replace with "Arlo platform URL" (people may get confused with FQDN)
  2. Replace help text under "Arlo platform URL" with "This is the URL of your Arlo management platform e.g. "yourplatform.arlo.co"
  3. Please change "API username" to "Arlo username"
  4. Add help text under "Arlo username" to state "The Arlo username must have API enabled, learn more." - link to https://support.arlo.co/hc/en-gb/articles/115003692863?utm_source=Moodle%20Marketplace&utm_medium=referral%20organic&utm_campaign=Moodle%20plugin%20configuration (article will be live once released)
  5. Please change "API Password" to "Arlo password"
  6. Once user adds Arlo platform URL, could we have "Forgotten your Arlo password?" link generated? e.g. https:///forgot-password
  7. Add space between "Arlo platform URL" and "Untick" box (align with 'Default: Empty")

image

Feedback welcomed. Submitted by Tim

Default setting: Push event results - enabled

Moodle Administration menu > Site administration > Plugins > Enrolments > Manage Arlo > Configuration

Under 'Resulting'

Should 'Push Event results' be enabled by default? Currently, this is disabled by default. This will cause issues for our support team as almost all users expect results for events to flow back into Arlo.

image

Confirmation of critical status handling

When integration encounters following HTTP status codes how should they be handled?

401 Unauthorized - Alert, disable plugin?
403 Forbidden - Alert, disable plugin?
500 Internal Server Error - Alert, retry?
503 Service Unavailable - Alert, retry?

Enrolement methods for an event or online activity aren't showing both event code and name

Steps:

  • Navigate to a new course
  • Choose "Course Administration" > "Enrolement methods"
  • Add method > Arlo enrolement
  • Select the drop down associated with either and Online Activity or Event

Results:

  • only the course code displays not the title. When associating an arlo template it will show both. This would help the user to show both event code and name (even if it has to be partially truncated)

image

New username creation

Under existing code when a new user needs to be created. A username is generated by using:
first 3 letters of firstname + first 3 letters of lastname + random 3 digit number

Testing against Arlo QA instance I found matching taking more time that expected and became a real problem with 5000 contacts. This was due to Contacts having first Arlo (1..n) and lastname REGS.

I also have issues generating usernames for people using special characters first, last names. Like Chinese UTF-8 characters.

Moodle does accept .@_a-z0-9 by default. Moodle does have a setting $CFG->extendedusernamechars not enabled by default that allows other characters.

Any thoughts on an alternative username scheme. Email address maybe?

Create a message provider

Relay important alerts like sync errors through MessageAPI

// Provider
$messageproviders = array (
    // Error alerts.
    'alerts' => array(
    ),
);

// Example of sender
$message = new \core\message\message();
$message->component = 'enrol_arlo';
$message->name = 'alert';
$message->notification = 1;
$message->userfrom = core_user::get_noreply_user();
$message->subject = get_string('usercommentedonaplansubject', 'core_competency', $fullname);
$message->fullmessage = $fullmessage;
$message->fullmessageformat = $format;
$message->fullmessagehtml = $fullmessagehtml;
$message->smallmessage = get_string('usercommentedonaplansmall', 'core_competency', array(
            'fullname' => $fullname,
            'plan' => $planname,
        ));
$message->contexturl = $url->out(false);
$message->contexturlname = $urlname;

// Message each recipient.
foreach ($recipients as $recipient) {
      $msgcopy = clone($message);
      $msgcopy->userto = $recipient;
      message_send($msgcopy);
}

New registrations on an associated Arlo template do not sync after upgrade

Steps:

  1. Install the older Arlo plugin for Moodle
  2. Create an Arlo event
  3. Create a Moodle course
  4. Associate the Moodle course to the Arlo template
  5. Upgrade the Arlo plugin to the latest
  6. Add a registration to the Arlo event

EXPECTED:
Arlo-to-Moodle connection on both courses should be retained after upgrade
New arlo registration is synced to Moodle

ACTUAL:
New Arlo registration has not synced to Moodle after a couple of hours

New Arlo Registration: Philip Woo
Moodle: https://dev-arlo.elearning.ac.nz/enrol/users.php?id=39
Arlo: https://arlomoodledemo.arlo.co/management/Console/#/onlineactivities/1015/registrations

Filter DateTime greater than LastModifiedDateTime unexpected resource return

When making a call to API I am receiving a resource when I don't expect any be returned.

Review attached file:

EventTemplates.xml.txt

The last modified date is

<LastModifiedDateTime>2017-05-11T01:27:13.858Z</LastModifiedDateTime>

This occurs when using either 2017-05-11T01:27:13+0000 or 2017-05-11T01:27:13.858Z in datetime filter.

Call with 2017-05-11T01:27:13+0000
https://arlomoodleqa.builds.arlosoftware.net/api/2012-02-01/auth/resources/eventtemplates/?expand=EventTemplate&filter=LastModifiedDateTime gt datetime('2017-05-11T01:27:13+0000')&orderby=LastModifiedDateTime ASC
Encoded
https://arlomoodleqa.builds.arlosoftware.net/api/2012-02-01/auth/resources/eventtemplates/?expand=EventTemplate&filter=LastModifiedDateTime%20gt%20datetime%28%272017-05-11T01%3A27%3A13%2B0000%27%29&orderby=LastModifiedDateTime%20ASC

Call with 2017-05-11T01:27:13.858Z
https://arlomoodleqa.builds.arlosoftware.net/api/2012-02-01/auth/resources/eventtemplates/?expand=EventTemplate&filter=LastModifiedDateTime gt datetime('2017-05-11T01:27:13.858Z')&orderby=LastModifiedDateTime ASC
Encoded
https://arlomoodleqa.builds.arlosoftware.net/api/2012-02-01/auth/resources/eventtemplates/?expand=EventTemplate&filter=LastModifiedDateTime%20gt%20datetime%28%272017-05-11T01:27:13.858Z%27%29&orderby=LastModifiedDateTime%20ASC

Thoughts?

Template linking - 1 Contact registered to 2 or more events will only sync once to Moodle

User story: a person fails the course, and wants to retake the course with a clean record (grade, progress, etc)

Steps:

  1. Create an Arlo template with 2 events (Event A that is near completion and Event B set to start in the future)
  2. Create a Moodle course
  3. Connect the Moodle course to the Arlo template
  4. Register User A to Arlo Event A
  5. Wait for it to sync and for Event A schedule to finish
  6. Register the same user to Arlo Event B
  7. Wait for it to sync to Event B

EXPECTED:
User gets another instance on the Moodle course

ACTUAL:
The user is only synced once

Platform OnChange

This a rare use case. Just confirming behaviour if a Moodle admin decides to change platform FQDN.

When a user changes the platform in Moodle, what is the expected behaviour?

All enrolment instances will be broken as reference previous platform. As well as template, event, online activity, contact syncing.

Do we drop data or rename?

I expect a new platform, so all previous associated data would be dropped?

Mat is working on a new Moodle admin setting that locks the text field and requires another action from admin to unlock and change platform.

Thoughts?

'Client connection error!' Cannot sync Arlo-Moodle

Getting a 'Client connection error!' on the Arlo Connection page which blocks QA from Syncing Arlo-Moodle

Please see error logs below

Thursday, 27 July 2017, 4:41 PM arlomoodleqa.builds.arlosoftware.net https://arlomoodleqa.builds.arlosoftware.net/api/2012-02-01/auth/resources/eventtemplates/?expand=EventTemplate&filter=CreatedDateTime%20gt%20datetime%28%271970-01-01T00%3A00%3A00%2B0000%27%29%20or%20LastModifiedDateTime%20gt%20datetime%28%271970-01-01T00%3A00%3A00%2B0000%27%29&orderby=LastModifiedDateTime%20ASC 0 cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Thursday, 27 July 2017, 4:41 PM | arlomoodleqa.builds.arlosoftware.net | https://arlomoodleqa.builds.arlosoftware.net/api/2012-02-01/auth/resources/events/?expand=Event%2CEvent%2FEventTemplate&filter=CreatedDateTime%20gt%20datetime%28%271970-01-01T00%3A00%3A00%2B0000%27%29%20or%20LastModifiedDateTime%20gt%20datetime%28%271970-01-01T00%3A00%3A00%2B0000%27%29&orderby=LastModifiedDateTime%20ASC | 0 | cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Thursday, 27 July 2017, 4:41 PM | arlomoodleqa.builds.arlosoftware.net | https://arlomoodleqa.builds.arlosoftware.net/api/2012-02-01/auth/resources/onlineactivities/?expand=OnlineActivity%2COnlineActivity%2FEventTemplate&filter=CreatedDateTime%20gt%20datetime%28%271970-01-01T00%3A00%3A00%2B0000%27%29%20or%20LastModifiedDateTime%20gt%20datetime%28%271970-01-01T00%3A00%3A00%2B0000%27%29&orderby=LastModifiedDateTime%20ASC | 0 | cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Grades on existing courses' registrations do not sync after upgrade

Steps:

  1. Install the older Arlo plugin for Moodle
  2. Create an Arlo event
  3. Create a Moodle course with a quiz
  4. Associate the Moodle course to the Arlo event
  5. Upgrade the Arlo plugin to the latest
  6. Add a registration to the Arlo event
  7. Once the registration is synced to Moodle, access the course as the registrant and take the quiz

EXPECTED:
Moodle grades sync to the Arlo event

ACTUAL:
Grades still have not synced after a couple of hours

Moodle: https://dev-arlo.elearning.ac.nz/enrol/users.php?id=36
Arlo: https://arlomoodledemo.arlo.co/management/Console/#/onlineactivities/1014

  • I took the Moodle quiz for Philip Woo but the grade details have not synced
    ** I retook the exam for Luke Armstrong, Nancy Mailinator, Joe Sara but the new grades have not synced
    Note: I manually removed the grade on Arlo before I retook the quiz

Changes on a merged contact do not reflect on Moodle

Steps:

  1. Create Contact A
  2. Create Contact B
  3. Create an event and connect to Moodle
  4. Register Contact A and wait for it to sync
  5. Merge Contact A & Contact B so A's name and/or email address change
  6. Check moodle users

EXPECTED:
Name/Email change on existing registrants update on Moodle

ACTUAL:
Changes via merging do not update on moodle

Arlo Course (MergedReg MergedReg2):
https://arlomoodleqa.builds.arlosoftware.net/management/Console/#/onlineactivities/11/registrations
image

Moodle Course (MergedReg MergedReg):
https://dev-arlo.elearning.ac.nz/enrol/users.php?id=32
image

Manual enrolment instance synchronization

Allow user to manually synchronize registrations and results for an Arlo enrolment instance.
screenshot-localhost-2017-07-10-10-58-02

// Potentially use a trace
$trace = new text_progress_trace();
or
$trace = new html_list_progress_trace()

$manager = new enrol_arlo\manager($trace)
$manager->process_instance_registrations($instance, true);

Migrate from old to new in upgrade handler

Add code to migrate existing clients from old integration to new integration.

IMPORTANT: Ensure any records that have old platform name convention are migrated to use new FQDN platform name convention. #11

  • Migrate Moodle users with mapped Arlo Contact GUID in user_profile_field to enrol_arlo_contact table

Arlo AuthAPI call log

Track each call to Arlo AuthAPI.

Create table:

  • id
  • timelogged
  • platform
  • uri
  • status - HTTP response status code
  • info - Exception information

Create admin page to view, needs to provide ordering by timelogged, status.

Grades are not consistently sync'd from Moodle to Arlo

Added additional related issues on the comments below

Platform OA with the issue: https://arlomoodleqa.builds.arlosoftware.net/management/Console/#/onlineactivities/4

Moodle course
https://dev-arlo.elearning.ac.nz/grade/report/grader/index.php?id=18

Steps:

  1. Create an Online Activity in Arlo
  2. Link this through Arlo enrolment
  3. Ensure that when creating the Moodle course, "Completion tracking" is set to "Yes".
    Ensure that under "Quiz administration" "Edit Settings" have:
  • Grade - Grade to pass is set to 2
  1. Setup a Quiz that has one question.
  2. Log in with the a registrant and complete (and pass) the test
  3. As admin sync the registrants manually through Enrolment methods
  4. Repeat the same task for a couple other registrants

Results:

  • Only the first sync comes through. The other registrants grades aren't sync'd

Also note: Progress status is incorrect

image

image

'Undefined variable' issue displayed on the Arlo Connection page

https://dev-arlo.elearning.ac.nz/admin/settings.php?section=enrolsettingsarlo

I noticed that the messages below have showed up and the Green status disappeared on the Connection page after the registrants of this event have synced and I have taken the quizzes as the registrants.

image

I also get an Error 400 when I look at the logs:

https://arlomoodledemo.arlo.co/api/2012-02-01/auth/resources/registrations/166/
BadRequestString was not recognized as a valid DateTime. at line 14

Arlo Course with Error 400:
https://arlomoodledemo.arlo.co/management/Console/#/onlineactivities/1014/registrations

Intermittent registration sync delay

I encountered this the first time I created 1 order in arlo with 3 registrants. I tried to replicate twice now but was not successful. Can we try to look at it?

Steps:

  1. Open an event/online activity
  2. Create an order with more than 1 registrants
  3. Link it to a Moodle course

EXPECTED:
All registrants are synced to Moodle

ACTUAL RESULT:
Only 2 out of 3 registrants were synced. The third one synced the same time i created another registration on another online activity (25 mins after the first 2 were synced)
*Could be a bug where it does not sync until there's a new registration

Arlo event (3 Registrants in 1 order):
image

Moodle course:
image

Add custom exceptions for deserializer

XmlDeserializer currently using standard PHP Exception class. Could add extended Exceptions for:

  • XmlParseException
  • ClassNotFoundException
  • XmlNoChildrenException

Grades aren't syncing a "failure" status

Steps:

  • Setup a connection to Arlo (tested online activity and basic public event)
  • create a quiz within Moodle
  • login with a sync'd participant and fail the test (get 1 point to ensure that points are sync'ing over properly)
  • Check Arlo after syncing

Results:

  • The "fail" status isn't passing through but the grade is. It's marking the student as passed... even though 10 is required for pass

image

image

Arlo Course:
https://arlomoodledemo.arlo.co/management/Console/#/events/50

Moodle Course:
https://dev-arlo.elearning.ac.nz/enrol/users.php?id=16

Design schema

Refactor schema.

    • New synchronization fields - can these be implemented in enrol table or will they need to live in new tables.
    • New tables will be required in enrol_arlo_* table namespace

Tables used across existing enrol and local plugins.

  • config_plugins

  • enrol coreenroltablecurrentslotusage.pdf

  • enrol_arlo_templatelink

  • local_arlo_api

  • local_arlo_contacts

  • local_arlo_events

  • local_arlo_mergerequests

  • local_arlo_onlineactivities

  • local_arlo_registrations

  • local_arlo_templates

  • local_arlo_userduplicates

Refactor add/associate template code

No more local plugin, so associate template page can only be injected into navigation via enrol_arlo_extend_navigation_course().

  • Create the page to link template. Move the form definition into classes/form.

Create Moodle events for:

  • event_created
  • event_updated
  • onlineactivity_created
  • onlineactivity_updated

Moodle events called in the manager class after DB writes:

  • update_event

  • update_onlineactivity

  • Wire up the observer to handle those events.

  • User creates a template association

  • Create DB record in enrol_arlo_templatelink table

  • Handling create/update events

  • Get Arlo enrol instance using type, sourceguid
    When event_created example:

$type = \enrol_arlo_plugin::ARLO_TYPE_EVENT;
$sourcestatus = $event->sourcestatus;
$sourceguid = $event->sourceguid;
$arloinstance = $DB->get_record('enrol_arlo_instance', array('type'=>$type, 'sourceguid'=>$sourceguid));
$instance = $DB->get_record('enrol', array('id'=>$arloinstance->enrolid));

Get enrol plugin
use classes\Arlo\AuthAPI\Enum\EventStatus;
If EventStatus::Active or EventStatus::Completed

$plugin = enrol_get_plugin('arlo');
$instance = $plugin->get_instance_defaults();
$instance->arlotype = $type;
$instance->arloevent = $sourceguid;
$plugin->add_instance($instance);

Else do nothing.

User deletes a template association

Progress status still show 'Not started' after grades have synced

Steps:

  1. On Arlo, create an online activity with registrations
  2. Create a moodle course and sync it to the arlo event
  3. Set up a quiz for the moodle course
  4. Once registrations have synced, log in as the registrant and take the quiz
  5. Check arlo once the grades have synced

EXPECTED:
All grade details are reflected correctly

ACTUAL:
The Progress status is still 'Not started' after grades have synced

Arlo Course:
https://arlomoodledemo.arlo.co/management/Console/#/onlineactivities/1015/registrations

Moodle Course:
https://dev-arlo.elearning.ac.nz/enrol/users.php?id=39

Importing registrations for event does not set LastModifiedDateTime

While testing I noticed that when importing registrations for event LastModifiedDateTime is not set.
This causes the problem of high watermark "LatestRegistrationModifiedDateTime" not being set. This causes the whole collection to be fetched and processed again. Should collection fetch be order by be "LastModifiedDateTime ASC, CreatedDateTime ASC " I guess this would keep processing until record modified, is there a chance LastModifiedDateTime never set for collection. Is this issue? Thoughts?

Add reload pix

Add reload image to pix for manual enrolment instance sync.

Set default settings for new installs

In enrol/db/install.php

Do something like:

set_config('matchuseraccountsby', 3,'enrol_arlo');
set_config('authplugin', 'manual','enrol_arlo');
set_config('onlineactivityresults', 1,'enrol_arlo');
set_config('eventresults', 0,'enrol_arlo');

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.