cul-2016 / quiz

11 stars 4 forks source link

Set up test environment for LTI #674

Closed Danwhy closed 6 years ago

Danwhy commented 6 years ago

To test the LTI integration, we'll need to deploy the current state of the app to staging, and set up the Moodle sandbox environment to integrate with Quodl.

I'll write up some documentation on how to go about doing that today.

Danwhy commented 6 years ago

@stianr The lti integration is live on staging now. I've written up a guide on what you need to do to set it up on Moodle here: https://github.com/cul-2016/quiz/blob/staging/LTI.md

I'll send you the required secret token in a separate email (as mentioned here)

stianr commented 6 years ago

Hi @Danwhy, thanks for everything on this. The leaderboard is working well. But I'm struggling with the LTI demo. I had to preconfigure Quodl, but that seemed fairly straightforward. I was then able to add it to my moodle page, and it looked as I think it should:

image

But clicking on a link opens a new tab with the correct URL, but gives a 400 error across multiple browsers:

image

It's possible that I've misconfigured something - maybe something I just missed because it's late at night. Alternatively, it could be that as the options and setup are slightly different for me than in the guide - we're going to update to moodle 3.4 later in the month, there are some different defaults or configurations that aren't working. Also, it could be that there's something about my user account that's an issue - e.g., being a lecturer rather than a student account, or similar.

I'll have another look tomorrow morning, but if you have access to the logs and can see anything obvious in the requests you've been getting from City moodle, then let me know.

iteles commented 6 years ago

@stianr Might also be worth having a quick screenshare with @Danwhy at some point tomorrow (Monday) morning if you're available if you haven't sussed this out after your initial review.

stianr commented 6 years ago

Yes, great idea. I'm free most of the day; I'll look again at what I've done, then if you can't see anything obvious @Danwhy I can show you the process I go through and we can look for any issues.

Danwhy commented 6 years ago

Hi @stianr, the main reason I can think of for seeing that error would be that the secret is not set/correct. Did you get the email I sent with the secret token in?

stianr commented 6 years ago

Hi @Danwhy, I did that - copied and pasted the code and checked it had 10 chars in case copying had picked up extra spaces.

Danwhy commented 6 years ago

Ok @stianr, it looks like the problem is due to heroku using https, which will require a little more configuration on our lti side to get it to work. I'll let you know when I think I've got it working so you can try again

stianr commented 6 years ago

Thanks @Danwhy - let me know when you want me to test anything.

Danwhy commented 6 years ago

@stianr Could you try again now? You shouldn't need to change any of the configuration, just try to access Quodl through the link again

stianr commented 6 years ago

@Danwhy - I'm in! Will test now and get back to you in this thread.

stianr commented 6 years ago

First comments:

Have a meeting now, but will test further in an hour or so. Great work!

stianr commented 6 years ago

image

But does appear to log in, as can then go direct to modules page without further login.

stianr commented 6 years ago
stianr commented 6 years ago
stianr commented 6 years ago

@Danwhy I think the current priority is to ensure that when any user clicks through from moodle to Quodl, they get to a page with their email address pre-filled (and possibly uneditable), and which requires them to enter a nickname before proceeding.

Happy to talk sometime this afternoon if it would help...

Danwhy commented 6 years ago

@stianr Hopefully the issues you mentioned have been resolved, if you'd like to give it another try and let us know if there's anything else

stianr commented 6 years ago

Thanks @Danwhy - would you be able to delete the accounts for StudentBadge1@city.ac.uk, StudentBadge2@city.ac.uk, and StudentBadge3@city.ac.uk, and for my email address as well? Then I can try signing up again from scratch.

Danwhy commented 6 years ago

@stianr 👍 Done

stianr commented 6 years ago

Signing up as lecturer - email address is uneditable, which is nice, but no email address visible - tried both Chrome and Firefox:

image

Register button doesn't work, presumably because email address is empty?

stianr commented 6 years ago

Works perfectly as student:

image

Danwhy commented 6 years ago

Strange, but it could be to do with the name of the email field coming from your Moodle version. I'll put a log in and get you to try again if that's ok

stianr commented 6 years ago

Sure - let me know when to have another go.

Danwhy commented 6 years ago

@stianr Ok, could you follow the link as a lecturer again please?

stianr commented 6 years ago

@Danwhy - I've just done it now.

Danwhy commented 6 years ago

I think I spotted the problem, should be fixed now

stianr commented 6 years ago

Fixed!

stianr commented 6 years ago

Different question: What happens with students who have already signed up with Quodl using their university email addresses. I registered as a student direct with Quodl first, then clicked through from moodle with the same email. It let me set up a separate account (studentbadge2@city.ac.uk). So there may be two instances of users with that single email address, which we'd ideally like to avoid. If I do it the other way round, set up an account via moodle, then try to register direct on Quodl with the same email, it tells me something went wrong and won't let me set up a second account.

For this PoC, it would be ideal if, when a user clicks through from moodle and is identified as not having clicked through from moodle before, a check is made for an existing user with the same email address. If the email address is found, it then keeps all the existing user details - quizzes completed, etc - but changes the account type to a moodle rather than password based one, and then the module that is associated with the moodle link that was just clicked is added to the student's dashboard. Is that feasible?

Danwhy commented 6 years ago

@stianr That should be what already happens. I've checked the database and there are two users with the same email address, but they have different casing (StudentBadge2@city.ac.uk vs studentbadge2@city.ac.uk). I will make sure to downcase the email on signup, but if you could do the same test with the exact same email addresses in the meantime, it would be good to see if it works.

stianr commented 6 years ago

That's great - could you delete the accounts for both of those versions of that email address and I'll have another go.

Danwhy commented 6 years ago

@stianr Deleted the accounts, and fixed it so the capitalisation shouldn't be an issue now

stianr commented 6 years ago

Think this may be having knock-on effects. I tried signing up direct with Quodl, then clicked through from moodle, but didn't click to merge accounts (though that seemed to be working) - then remembered I hadn't added any modules, so went back and tried to log in direct with Quodl, and was told my institutional subscription had expired - as far as I'm aware, students should never see this:

image

Danwhy commented 6 years ago

It looks like studentbadge2@city.ac.uk is signed up as a lecturer, either through Quodl or Moodle. I'll look into what's happened

Danwhy commented 6 years ago

@stianr I think some of the problems were caused by the session information in the cookie being stored and so not matching when you logged in as two different users through Moodle. That should be fixed now, but if you do have any trouble in testing again, could you take that into account and try using different browsers/incognito mode.

stianr commented 6 years ago

Thanks @Danwhy - I've been mainly using incognito mode for doing this, but may not have done so all the time. Will do it consistently when testing now.

stianr commented 6 years ago

All seems to be working - I've tried:

In both cases I could still log in via the site in the usual way, so the problem above seems fixed. Once I entered the correct password, the accounts seemed to be merged.