openlab-at-city-tech / webworkqa

WeBWorK integration for WordPress and BuddyPress
GNU General Public License v2.0
4 stars 2 forks source link

More flexible way for course list to be generated #119

Closed boonebgorges closed 3 years ago

boonebgorges commented 6 years ago

Instructor email notifications - the emails that are sent to a teacher when a question is posted in his/her courses - require a mapping of course IDs to instructor email addresses. See #69. This works currently by the webwork_section_instructor_map filter, which maps course names to instructor emails; the OpenLab has a callback attached to this filter that provides this data. This is not a viable solution going forward.

If WeBWorK had an API for fetching a list of courses, as well as fetching instructor information based on course, that'd be ideal.

In the absence of that, we may need some sort of administrator-facing tool for associating course names (either as they're retrieved dynamically from WeBWorK at the time of posting, or based on manual entry at, say, the beginning of the term) with email addresses or, better still, WordPress user accounts.

drdrew42 commented 6 years ago

This might just be another kludge - but we could utilize one of the as-yet unused fields (section or recitation) in the class list DB to hold information about the instructor until an API is online. The question is whether or not these fields appear in the data being sent over to OL-WW...

This structure would also address the issue that I vaguely referred to during our meeting - with many sections being handled together in one WW "course".

boonebgorges commented 5 years ago

See https://github.com/livinglab/webwork-for-wordpress/issues/69#issuecomment-431154001

drdrew42 commented 5 years ago

From Mike Gage:

feedbackMacro()

The relevant code which creates the form is in ContentGenerator.pm around lines1609 to 1700.

You could probably add extra data in feedbackMacro_form(). Another possibility is to add it to the parameters %params where feedbackMacro is called: e.g. in Problem.pm, and 3 or four other places where the email the prof button occurs.

https://github.com/openwebwork/webwork2/blob/master/lib/WeBWorK/ContentGenerator/Problem.pm#L2070

In the absence of a full-blown API, what additional data would we need to have included in the POST (assuming this remains a one-way street)?

drdrew42 commented 5 years ago

I'm thinking we need:

Am I overlooking anything?

boonebgorges commented 5 years ago

@drdrew42 Thank you for following up about this! I assume that Mike is suggesting adding these fields to WW itself, right? A kludge that only works for our installation is probably not a great path forward.

I'll add the following items to your list:

these would help create "back" links and the like.

With all this data in place, we could remove about 75% of the URL/referer/body parsing that's currently in the plugin. Huge win. The remaining parsing would be related to formatting the content itself.

drdrew42 commented 5 years ago

Yes, we'd be adding fields to the package of data that gets delivered.

I guess in order to generate those links, we'd only need the base of the WW URL, since the URL structure is always the same: $baseURL\$sectionID\$problemSetName\

Would these links be relevant to the OL site, or just in the email notification that gets sent to the instructor?

boonebgorges commented 5 years ago

If it's true that the URLs are always generated in this way (ie it's not a City Tech specific thing) then you're right that we don't need the additional information at the moment - we can concatenate the URLs. That said, if WW changes the URL format in the future, we'd have to rewrite our logic; while if they simply sent us a URL we could trust, they could make changes and our system would continue to work. I'd say ask for the URLs if you don't think it'll be too much trouble for the devs - it's better for forward-compatibility.

With these URLs, we could potentially have "view this problem on WeBWorK" or "view this course on WeBWorK" links in the interface at some point down the line. I know that this might currently be difficult to do because of the way that WW authentication works (username params are sometimes passed around when browsing the site) but having the URLs makes it at least possible. Again, trying to think about the future, so we only have to ask for this once :)

drdrew42 commented 5 years ago

Okay, yes, let's do the full URLs. You're absolutely right, this will keep everything in much better shape moving forward.

drdrew42 commented 5 years ago

Do you happen to have retained any content related to what the raw POST data looks like at present? I'm trying to decipher the Feedback.pm module and the related CGI POST construction...

boonebgorges commented 5 years ago

Sure thing. Here's what it looks like:

  [user] => bgorges                                                          
  [effectiveUser] => bgorges
  [key] => 0SFmuLm8d6HJWDpX6XaYrFElbmau0dl6
  [showCorrectAnswers] => 0
  [set] => 2-ComplexFractions
  [displayMode] => MathJax
  [module] => WeBWorK::ContentGenerator::Problem
  [showSolutions] => 1
  [pg_object] => PHNjcmlwdCB0eXBlPSJ0ZXh0L3gtbWF0aGpheC1jb25maWciPgogICAgICAg      ICAgICAgICAgICBNYXRoSmF4Lkh1Yi5Db25maWcoewogICAgICAgICAgICAgICAgICAgICBNYXRoTWV      udToge3Nob3dDb250ZXh0OiB0cnVlfQogICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgIC      AgICAgPC9zY3JpcHQ+CgkJCQkgIDxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4gCgkJCQkgI      GlmKCF3aW5kb3cuTWF0aEpheCkgCgkJ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4X1ByZXZpZXciPlttYXRoXTwvc3B      hbj48c2NyaXB0IHR5cGU9Im1hdGgvdGV4Ij5mKHgpPC9zY3JpcHQ+IGlzIDogPGlucHV0IHR5cGU9dG      V4dCBjbGFzcz0iY29kZXNoYXJkIiBzaXplPTIwIG5hbWU9IkFuU3dFcjAwMDEiIGlkPSJBblN3RXIwM      DAxIiBhcmlhLWxhYmVsPSJhbnN3ZXIgMSAiIHZhbHVlPSIiLz4KPGlucHV0IHR5cGU9aGlkZGVuICBu      YW1lPSJwcmV2aW91c19BblN3RXIwMDAxIiB2YWx1ZT0iIi8+Cgo8QlIvPgpZb3VyIGFuc3dlciBmb3I      gdGhlIGZ1bmN0aW9uIDxzcGFuIGNsYXNzPSJNYXRoSmF4X1ByZXZpZXciPlttYXRoXTwvc3Bhbj48c2      NyaXB0IHR5cGU9Im1hdGgvdGV4Ij5nKHgpPC9zY3JpcHQ+IGlzIDogPGlucHV0IHR5cGU9dGV4dCBjb      GFzcz0iY29kZXNoYXJkIiBzaXplPTIwIG5hbWU9IkFuU3dFcjAwMDIiIGlkPSJBblN3RXIwMDAyIiBh      cmlhLWxhYmVsPSJhbnN3ZXIgMiAiIHZhbHVlPSIiLz4KPGlucHV0IHR5cGU9aGlkZGVuICBuYW1lPSJ      wcmV2aW91c19BblN3RXIwMDAyIiB2YWx1ZT0iIi8+Cgo8QlIvPgoKPHA+PGI+Tm90ZTogPC9iPjxpPl      lvdSBjYW4gZWFybiBwYXJ0aWFsIGNyZWRpdCBvbiB0aGlzIHByb2JsZW0uPC9pPjwvcD4=
  [showOldAnswers] => 1
  [showHints] => 1
  [problem] => 5
  [feedbackForm] => Ask For Help

pg_object is a base64-encoded string representing the markup of the problem. I decode it and clean it up for display in WP. (I also parse LibraryID etc from it, but that'd go away in the future.)

drdrew42 commented 5 years ago

I'm going to start experimenting with this, is it possible to set up the OL-dev site to display the raw POST data? (Or a separate address at which I can point the delivery of this payload to see whether it contains what I want?)

boonebgorges commented 5 years ago

Sure thing. I've just set it up. When you click Ask for Help, the openlabdev.org/webwork-playground site will show the decoded content of the POST. It's not totally raw (the problem_text has been parsed) but I think it's probably enough for you to work with.

ping @bree-z FYI that funny things might happen on webwork-playground while this temporary tool is in place.

drdrew42 commented 5 years ago

LOL, I just set up a PHP to echo POST data ;)

boonebgorges commented 5 years ago

yes, that's probably easier :-D

drdrew42 commented 5 years ago

I've made significant progress on incorporating the info we want - but there are still a couple lingering issues that I can't get traction on so far.

drdrew42 commented 5 years ago

Okay, POST now looks like:

user => aparker
effectiveUser => aparker
key => gC3lBzgIJa9dKLstW8EL5LuBOUBdCgK6
pg_object => PHNjcmlwdCB0eXBlPSJ0ZXh0L3gtbWF0aGpheC1jb25maWciPgogICAgICAgICAgICAgICAgICBNYXRoSmF4Lkh1Yi5Db25maWcoewogICAgICAgICAgICAgICAgICAgICBNYXRoTWVudToge3Nob3dDb250ZXh0OiB0cnVlfQogICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgPC9zY3JpcHQ+CgkJCQkgIDxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4gCgkJCQkgIGlmKCF3aW5kb3cuTWF0aEpheCkgCgkJCQkgIChmdW5jdGlvbiAoKSB7CiAgCQkJCQl2YXIgc2NyaXB0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgic2NyaXB0Iik7CiAgCQkJCQlzY3JpcHQudHlwZSA9ICJ0ZXh0L2phdmFzY3JpcHQiOwogIAkJCQkJc2NyaXB0LnNyYyAgPSAiL3dlYndvcmsyX2ZpbGVzL21hdGhqYXgvTWF0aEpheC5qcz9jb25maWc9VGVYLU1NTC1BTV9IVE1Mb3JNTUwtZnVsbCI7CiAgCQkJCQlkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiaGVhZCIpWzBdLmFwcGVuZENoaWxkKHNjcmlwdCk7CgkJCQkJfSkoKTsgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgIDwvc2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VyMDAxMCIgaWQ9IkFuU3dFcjAwMTAiIGFyaWEtbGFiZWw9ImFuc3dlciAxMCAiIHZhbHVlPSIiLz4KPGlucHV0IHR5cGU9aGlkZGVuICBuYW1lPSJwcmV2aW91c19BblN3RXIwMDEwIiB2YWx1ZT0iIi8+CiZuYnNwOzxCPjMuPC9CPiA8c3BhbiBjbGFzcz0iTWF0aEpheF9QcmV2aWV3Ij5bbWF0aF08L3NwYW4+PHNjcmlwdCB0eXBlPSJtYXRoL3RleCI+XHNpbigyeCk8L3NjcmlwdD48QlI+PC9URD48VEQ+IDxCTE9DS1FVT1RFPgo8YnIgLz4gPGI+QS48L2I+IDxzcGFuIGNsYXNzPSJNYXRoSmF4X1ByZXZpZXciPlttYXRoXTwvc3Bhbj48c2NyaXB0IHR5cGU9Im1hdGgvdGV4Ij5cY29zKHgpPC9zY3JpcHQ+CjxiciAvPiA8Yj5CLjwvYj4gPHNwYW4gY2xhc3M9Ik1hdGhKYXhfUHJldmlldyI+W21hdGhdPC9zcGFuPjxzY3JpcHQgdHlwZT0ibWF0aC90ZXgiPjJcY29zKDJ4KTwvc2NyaXB0Pgo8YnIgLz4gPGI+Qy48L2I+IDxzcGFuIGNsYXNzPSJNYXRoSmF4X1ByZXZpZXciPlttYXRoXTwvc3Bhbj48c2NyaXB0IHR5cGU9Im1hdGgvdGV4Ij4tXHNpbih4KTwvc2NyaXB0Pgo8YnIgLz4gPGI+RC48L2I+IFRoZSBkZXJpdmF0aXZlIGlzIG5vdCBwcm92aWRlZAo8L0JMT0NLUVVPVEU+CjwvVEQ+CjwvVFI+CgogICAgPC9UQUJMRT4KCgo8cD48Yj5Ob3RlOiA8L2I+PGk+WW91IGNhbiBlYXJuIHBhcnRpYWwgY3JlZGl0IG9uIHRoaXMgcHJvYmxlbS48L2k+PC9wPg==
showCorrectAnswers => 0
showHints => 1
module => WeBWorK::ContentGenerator::Problem
displayMode => MathJax
showSolutions => 1
set => MAAtutorial
problem => 5
showOldAnswers => 1
problemSource => setMAAtutorial/matchinglistexample.pg
randomSeed => 2005
studentName => Andrew Parker
problemSetID => MAAtutorial
courseID => AchievementTesting
emailURL => http://localhost/webwork2/AchievementTesting/MAAtutorial/5/?showOldAnswers=1&effectiveUser=aparker&displayMode=MathJax
returnURL => /webwork2/AchievementTesting/MAAtutorial/5/?key=gC3lBzgIJa9dKLstW8EL5LuBOUBdCgK6&effectiveUser=aparker&displayMode=MathJax&showOldAnswers=1&user=aparker
email1 => "Andrew Parker" <testemail@citytech.cuny.edu>
feedbackForm => Testing
boonebgorges commented 5 years ago

Thanks for your work on this - looks like it's getting close. A couple questions based on this output:

drdrew42 commented 5 years ago

Okay, emailURL is for inclusion in the notification email to instructors - this is a feature from the email instructor that I've received several requests for. Clicking it allows an instructor to go directly to the student's problem with direct access to their history of responses to the problem. This is not something that is relevant to OL for display.

drdrew42 commented 5 years ago

Also, there may be multiple email#n as multiple users may be authenticated for receiving emails from students.

drdrew42 commented 5 years ago

Oh, and also relevant - the combination of problemSource and randomSeed should allow us to make use of API requests for WeBWorK to handle the rendering of problems remotely. I don't know if that's something desirable or not, but I just thought I'd throw it in there.

boonebgorges commented 5 years ago

Excellent - this is all helpful.

No worries about email# parsing - I can do that on my end. Just wanted to see whether it's a decision you'd made yourself. Generally, better for me to receive more fine-grained info.

drdrew42 commented 5 years ago

Yes, understandable. I'll see if I can finagle the DB lookup for an instructor more specifically, along with refining the courseURL and problemSetURL links.

drdrew42 commented 5 years ago

@boonebgorges if I push these changes to the production machine, is there any chance that it affects the OL side? None of the existing key-value pairs have been modified.

drdrew42 commented 5 years ago

in the very short term, it allows us to pull the (now hidden by default) libraryID/problemSource - and it also allows us to skip the creation of the instructor -> email hash.

Other changes, such as passing the emailURL through to the content of the notification message can certainly wait. But if the above two changes are quick, maybe we can pass them through.

For example, leave the code to pull the libraryID as it's been done in the past, but if it comes up blank, then pull the libraryID from the problemSource variable that is passed here in the POST. That way we can fall back to the old way very easily, if necessary.

boonebgorges commented 5 years ago

As long as you're not touching existing data, I don't see that it should cause any harm.

I can try to squeeze in one or both of the suggested fixes if you can get them onto the WW-Dev instance ASAP. The instructor -> email hash especially seems like it would be a timesaver.

drdrew42 commented 5 years ago

Okay, the POST data should now contain the content as described above. One minor change: email1 => "Andrew Parker" <testemail@citytech.cuny.edu> is now emailName1 => Andrew Parker emailAddress1 => testemail@citytech.cuny.edu

boonebgorges commented 5 years ago

Thank you, @drdrew42. Looking over the logic, I don't think this is something I can squeeze in right now. I don't currently have a mechanism for storing this data, so there'll be a non-trivial amount of potentially breaking work that'll need to happen to process, store, and retrieve email data. I'll work on it through the spring. In the meantime, I'm afraid we'll have to fall back on the email hash for Spring 2019.

drdrew42 commented 5 years ago

no problem, I'll start keeping an instructor list

drdrew42 commented 5 years ago

Let me re-surface a prior suggestion here - that we switch over to pulling the problemSource or the problemID from the POST instead of from the problem text.

As of the spring 2019 update to WW, the problem text no longer contains this problemID (path to the problem source code) by default. In fact, this path-to-source really should not appear in any problem text as it is completely irrelevant to the end-user.

I have found a way to re-enable the old behavior (because without it, our entire functionality breaks), but it involves modifying each course individually. We really should make this modification before others attempt to install.

Thanks to @bree-z for reminding me of this behavior...

boonebgorges commented 5 years ago

Thanks @drdrew42 - To be clear, what you're suggesting here doesn't have anything to do with the way that "course lists are generated" - the specific thing being proposed in this ticket; it has to do with identifying the "source problem" or "library ID" of a WeBWorK question, using a technique similar to what's being proposed here for course identification (namely, sending the information explicitly in the POST data). I'll open a separate ticket so that we don't lose track, as I agree that this is currently one of the most fragile parts of the system.

drdrew42 commented 5 years ago

Yes, that's correct - I ended up here because this is where I reminded myself of what I put in the updated POST data.

boonebgorges commented 4 years ago

As noted in https://github.com/livinglab/webwork-for-wordpress/issues/169#issuecomment-541106500, the new information from WeBWorK is now being stored by the plugin, including notifyAddresses. notifyAddresses is then being used to determine who should get the notification for a specific question.

I've left in support for the section-instructor map that we've previously used. It's only looked at as a fallback: if notifyAddresses is present for a given question, it's used, and the section-instructor map is ignored. This is to help us avoid duplicates and other problems like that.

A conceptual change that's worth noting is that we're no longer looking at a question's section in order to determine who should get email notifications. Instead, the list of notifyAddresses is stored on a per-question basis. This creates some redundancy - an instructor's email address may be stored on the WP side many, many times. Not an issue to worry about, probably, but I wanted to note it for the historical record.

bree-z commented 3 years ago

Email notifications look good. Everything seems to be working as expected for questions posted by users, as well as the ability to follow and unfollow threads.

If this seems fine, we can close this, thanks!

boonebgorges commented 3 years ago

Great, thanks!