mitodl / teachersportal

MIT ODL Teacher's Portal
0 stars 0 forks source link

Integration for Edx & async PurchaseOrder creation #485

Closed justinabrahms closed 8 years ago

justinabrahms commented 8 years ago

What are the relevant tickets?

Refs #457

What's this PR do?

Makes it so edx can speak w/ teacher's portal and vice versa Makes async creation of ccxs via the PurchaseOrder admin.

Where should the reviewer start?

tasks.py

How should this be manually tested?

You'll need to setup another ccxcon instance in edx which points to TP.

https://localhost.daplie.com:8000/admin/ccxcon/ccxcon/ ccxcon

You'll need to setup djangosslserver on edx so you can speak to it over https.

On devstack: pip install django-sslserver Add it to INSTALLED_APPS in lms/envs/devstack.py Run lms with python manage.py lms --settings=devstack runsslserver 0.0.0.0:8000 --certificate=cert/fullchain.pem --key=cert/privkey.pem

You'll need to set a course (I used edx demo course) up on edx to use the TP endpoint for it's ccx connector url & enable it for ccx.

at http://localhost:8001/settings/advanced/course-v1:edX+DemoX+Demo_Course ccxcon-url

You'll need to create a purchase order for this course that you've imported & validate that you get a ccx id back.

ccx-info

From here, you shouldn't get any errors in celery. On refresh, the ccx_id will be populated.

Any background context you want to provide?

This should be the final work necessary to delete ccxcon from a code perspective. There is still configuration & devops stuff to do.

Screenshots (if appropriate)

What GIF best describes this PR or how it makes you feel?

noisecapella commented 8 years ago

It doesn't look like there's a way to attach a UserInfo to a BackingInstance through the Django admin, not sure if that matters though since we'll only need to do it once per edX instance

noisecapella commented 8 years ago

I'm getting this validation error from the edX side, from our request to the course blocks API:

{
    "field_errors": {
        "username": {
            "developer_message": "This field is required unless all_blocks is requested."
        }
    }
}

Using this URL: /api/courses/v1/blocks/?course_id=course-v1%3AedX%2BDemoX%2BDemo_Course&username=&depth=all&requested_fields=children%2Cdisplay_name%2Cid%2Ctype%2Cvisible_to_staff_only

noisecapella commented 8 years ago

Looks like I forgot to set the backinginstance username

noisecapella commented 8 years ago

It looks like we don't generate UUIDs anymore. They're left blank and the user is required to set them when they mark the courses or modules live. I feel like we should generate these automatically on creation, or else change the rest APIs to pass the primary key instead. I'll file another issue for this, don't want it to block this PR

noisecapella commented 8 years ago

This may be an unsolvable problem, but if you save the purchase order and the CCX creation fails for some reason, you still get a success message: The purchase order "Purchase of george's new ccx - 20 seats on edX Demonstration Course (uuid1)" was added successfully.

justinabrahms commented 8 years ago

uuids are an artifact of ccxcon. We can generate them if you want, but they'll only be used internally to TP now.

justinabrahms commented 8 years ago

"this was added successfully" is the correct message. The purchase order is set, but the status is "processing" in the admin. A groomer script can be written to report on purchase orders who have been "processing" for more than some period of time.

noisecapella commented 8 years ago

Happy last PR! :+1: